什么是nginx.conf ERROR:'指令不允许在这里'?

时间:2018-03-10 21:00:49

标签: nginx

这里不允许使用什么NGinx'指令'错误?我试图第一次使用NGinx,并在Docker容器中,我使用其他网站的示例配置似乎是正确的配置,但我得到这个错误,无论我如何配置nginx.conf文件,而且我不知道为什么。

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

Link to my Github project branch (not master) demonstrating the problem.

我已经用Google搜索了这个错误,看到很多答案表明这是一个简单的解决方案,而且我已经尝试了所有这些。

例如,如果我像这样配置我的nginx.conf文件,我会收到错误:

# nginx.conf
user  nobody;

1 个答案:

答案 0 :(得分:2)

感谢@melpomene的回复,解决了3件事:

  1. 首先,我必须根据我的nginx.conf复制到正确的位置   Nginx 'complex config'文档。
  2. 我还必须复制(通过docker run volume mount)空/etc/nginx/logs   文件夹到位,因为看起来Nginx无法独立创建文件夹?
  3. 我必须提供mime.types文件。
  4. 我的最新回购信息在这里:https://github.com/djangofan/docker-tomcat7-cluster

相关问题