title: nginx: [emerg] "http" directive is not allowed here in /etc/nginx/conf.d/default.conf:1
body: <p>I'm trying to setup a server with nginx and docker-compose, but I get these errors every time I try 'docker-compose up': </p>
  
  <pre><code>webserver | 2019/06/10 13:04:16 [emerg] 1#1: "http" directive is not allowed here in /etc/nginx/conf.d/default.conf:1
  webserver | nginx: [emerg] "http" directive is not allowed here in /etc/nginx/conf.d/default.conf:1
  </code></pre>
  
  <p>I've tried wrapping all up with html {}, removing server {}, another port instead of 80...</p>
  
  <p>nginx Dockerfile</p>
  
  <pre><code>FROM nginx
  
  COPY default.conf /etc/nginx/conf.d/default.conf
  </code></pre>
  
  <p>default.conf</p>
  
  <pre><code>server {
      listen       80;
      server_name  localhost;
  
      location / {
          proxy_set_header  Host $host;
          proxy_set_header  X-Real-IP $remote_addr;
          proxy_pass http://app:8080/;
      }
  
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   /usr/share/nginx/html;
      }
  }
  </code></pre>