title: How to solve "http" directive is not allowed here in /etc/nginx/sites-enabled/default:1
body: <p>I follow this <a href="https://aiohttp.readthedocs.io/en/stable/deployment.html" rel="nofollow noreferrer">step</a> but somehow this throws error..</p>
  
  <p>default config is</p>
  
  <pre><code>http {
    upstream alert {
      # fail_timeout=0 means we always retry an upstream even if it failed
      # to return a good HTTP response
  
      # Unix domain servers
      server unix:/tmp/alert_1.sock fail_timeout=0;
      server unix:/tmp/alert_2.sock fail_timeout=0;
      server unix:/tmp/alert_3.sock fail_timeout=0;
      server unix:/tmp/alert_4.sock fail_timeout=0;
  
      # Unix domain sockets are used in this example due to their high performance,
      # but TCP/IP sockets could be used instead:
      # server 127.0.0.1:8081 fail_timeout=0;
      # server 127.0.0.1:8082 fail_timeout=0;
      # server 127.0.0.1:8083 fail_timeout=0;
      # server 127.0.0.1:8084 fail_timeout=0;
    }
    server {
      listen 80;
      client_max_body_size 4G;
  
      server_name myiphere;
  
      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://alert;
      }
  
      location /static {
        # path for static files
        root /mylocation/static;
      }
  
    }
  }
  </code></pre>
  
  <blockquote>
    <p>nginx: [emerg] "http" directive is not allowed here in /etc/nginx/sites-enabled/default:1
    nginx: configuration file /etc/nginx/nginx.conf test failed</p>
  </blockquote>