title: What is the nginx.conf ERROR: 'directive not allowed here'?
body: <p>What is the NGinx 'directive not allowed here' error?   I am trying to use NGinx for the first time, and within a Docker container, and I am using example configurations from other websites that seem to be correct configurations, but I get this error, no matter how I configure the nginx.conf file, and I don't know why.</p>
  
  <pre><code>2018/03/10 20:52:20 [emerg] 1#1: "user" directive is not allowed 
    here in /etc/nginx/conf.d/nginx.conf:6
  
  nginx: [emerg] "user" directive is not allowed here 
    in /etc/nginx/conf.d/nginx.conf:6
  </code></pre>
  
  <p><a href="https://github.com/djangofan/docker-tomcat7-cluster/tree/broken1" rel="nofollow noreferrer">Link to my Github project branch (not master) demonstrating the problem.</a></p>
  
  <p>I have Googled this error and see lots of answers suggesting it is a simple fix and I have tried them all.</p>
  
  <p>For example, if I configure my nginx.conf file like so, I get the error:</p>
  
  <pre><code># nginx.conf
  user  nobody;
  </code></pre>