title: Django nginx invalid HTTP_HOST header
body: <p>I am getting emails every day from bots hitting my server with the wrong http_header. I followed the steps here:
  <a href="https://stackoverflow.com/questions/25370868/django-error-invalid-http-host-header-u-run-myprojectname-gunicorn-sock/44118369#44118369">Django ERROR: Invalid HTTP_HOST header: u&#39;/run/myprojectname/gunicorn.sock:&#39;</a></p>
  
  <p>And I thought that would solve it. The problem is now that if you try to go to <code>https://35.***.***.***/</code> I can still get it to trigger an Invalid HTTP_HOST email to myself.</p>
  
  <p>I tried solving this by adding <code>listen 443 default_server;</code>:</p>
  
  <pre><code>server {
      listen 443 default_server;
      listen 80 default_server;
      return 444;
  }
  </code></pre>
  
  <p>But now legit traffic to my site is also blocked. 
  Here's my full config. Any help is much appreciated.</p>
  
  <pre><code>server {
      # default server
      listen 80 default_server;
      return 444;
  }
  
  server {
      listen 80;
      server_name mysite.com www.mysite.com;
  
      root /home/ubuntu/web/troopers/;
  
      location /static/ {
          # if asset versioning is used
          if ($query_string) {
              expires max;
          }
      }
  
      access_log /home/ubuntu/web/logs/troopersAccess.log;
      error_log  /home/ubuntu/web/logs/troopersError.log;
  
      location / {
          uwsgi_pass   unix:///home/ubuntu/web/troopersuwsgi.sock;
          include      uwsgi_params;
      }
  
      # what to serve if upstream is not available or crashes
      error_page 400 /400.html;
      error_page 403 /403.html;
      error_page 404 /404.html;
      error_page 500 502 503 504 /500.html;
  
      # Compression
      gzip on;
      gzip_http_version 1.0;
      gzip_comp_level 5;
      gzip_proxied any;
      gzip_min_length  1100;
      gzip_buffers 16 8k;
      gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
      # Some version of IE 6 don't handle compression well on some mime-types,
      # so just disable for them
      gzip_disable "MSIE [1-6].(?!.*SV1)";
      # Set a vary header so downstream proxies don't send cached gzipped
      # content to IE6
      gzip_vary on;
  
      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/mysite.com/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/mysite.com/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  
      if ($scheme != "https") {
          return 301 https://$host$request_uri;
      } # managed by Certbot
  }
  </code></pre>