title: nginx: [emerg] "http" directive is not allowed here in /etc/nginx/sites-enabled/default:1
body: <p>I'm new to NGINX and I'm trying to setup minimal working thing. So I trying to run aiohttp mini-app with nginx and supervisor (by <a href="http://aiohttp.readthedocs.io/en/stable/deployment.html" rel="noreferrer">this</a> example). But I can't configure Nginx right and getting the following error:</p>
  
  <pre><code>nginx: [emerg] "http" directive is not allowed here in /etc/nginx/sites-enabled/default:1
  </code></pre>
  
  <p>Here is full default.conf file:</p>
  
  <pre><code>http {
    upstream aiohttp {
      # Unix domain servers
      server unix:/tmp/example_1.sock fail_timeout=0;
      server unix:/tmp/example_2.sock fail_timeout=0;
      server unix:/tmp/example_3.sock fail_timeout=0;
      server unix:/tmp/example_4.sock fail_timeout=0;
    }
  
    server {
      listen 80;
      client_max_body_size 4G;
  
      server example.com;
  
      location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect off;
        proxy_buffering off;
        proxy_pass http://aiohttp;
      }
    }
  
  }
  </code></pre>
  
  <p>It looks correct. <code>server</code> directive is in <code>http</code> as it should be. And http is parent directive. What I'm doing wrong?</p>