title: invalid parameter server_name in /etc/nginx/sites-enabled/django
body: <p>I've deployed a Django application on DigitalOcean. 
  First off, when i try to secure this with https and ssl, I get this error.</p>
  
  <p>when i run nginx -t :</p>
  
  <p>nginx: [emerg] invalid parameter "server_name" in /etc/nginx/sites-enabled/django:12</p>
  
  <p>nginx: configuration file /etc/nginx/nginx.conf test failed </p>
  
  <pre><code>upstream app_server {
  server unix:/home/django/gunicorn.socket fail_timeout=0;
  }
  
  server {
      #listen 80 default_server;
      #listen [::]:80 default_server ipv6only=on;
  
      listen 443 ssl
      server_name domain.com
      ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem
      ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
      root /usr/share/nginx/html;
      index index.html index.htm;
  
    client_max_body_size 4G;
    server_name _;
  
    keepalive_timeout 5;
  
    # Your Django project's media files - amend as required
    location /media  {
        alias path/to/media;
    }
  
    # your Django project's static files - amend as required
    location /static {
        alias path/to/static;
    }
  
    # Proxy the static assests for the Django Admin panel
    location /static/admin {
       alias path/to/staticadmin;
    }
  
  location / {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
          proxy_redirect off;
          proxy_buffering off;
  
          proxy_pass http://app_server;
  }
  
  
  }
  
   server {
          listen 80;
         server_name domain.com;
         return 301 https://$host$request_uri;
   }
  </code></pre>
  
  <p>Furthermore, I can access the website using the ip address but not the domain name registered.It results in a 400 bad request page.
  Could this be an issue with the settings.py ?</p>
  
  <p>for reference in settings.py<code>ALLOWED_HOSTS=['*']</code>. What list do I provide in the ip_addresses() function? </p>
  
  <p>Are these two problems related?</p>
  
  <p>using Django v1.10.5</p>