title: nginx: [emerg] "server" directive is not allowed here
body: <p>I have reconfigured nginx but i can't get it to restart using the following config:</p>
  <p>conf:</p>
  <pre><code>server {
     listen 80;
     server_name www.example.com;
     return 301 $scheme://example.com$request_uri;
  }
  
  
  server {
     listen 80;
     server_name example.com;
  
     access_log /var/log/nginx/access.log;
     error_log  /var/log/nginx/error.log;
  
     location /robots.txt {
         alias /path/to/robots.txt;
         access_log off;
         log_not_found off;
     }
  
     location = /favicon.ico { access_log off; log_not_found off; }
  
     location / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout 30;
        proxy_read_timeout 30;
        proxy_pass http://127.0.0.1:8000;
     }
  
     location /static {
        expires 1M;
        alias  /path/to/staticfiles;
     }
  }
  </code></pre>
  <p>after running <code>sudo nginx -c conf -t</code> to test the configuration the following error is returned i can't figure out what is really the problem</p>
  <pre><code>nginx: [emerg] &quot;server&quot; directive is not allowed here in    /etc/nginx/sites-available/config:1
  nginx: configuration file /etc/nginx/sites-available/config test failed
  </code></pre>