我正在使用nginx 1.4.1.在复制了独角兽的例子之后nginx.conf,我发现必须将设置移动到不同的指令.我仍然无法管理放置在下面的设置nginx.conf文件:worker_processes,user,pid和events块.当我按原样放置它们时,日志显示directive is not allowed here.我该怎么办?
worker_processes 1;
user deployer sudo; # for systems with a "nogroup"
pid /run/nginx.pid;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # "on" if nginx worker_processes > 1
}
upstream abc {
...
}
server {
...
}
Run Code Online (Sandbox Code Playgroud)
我知道这篇文章,但是无论我做什么都没有用,这很奇怪.我在nginx中找不到任何文档.
原始示例不能直接使用,因为主要配置位于/etc/nginx/nginx.conf./etc/nginx/nginx.conf有http指令,包括sites-enabled/*指令.唯一的变化是/etc/nginx/nginx.conf是:
work_processes 4;
worker_connections 1024;
Run Code Online (Sandbox Code Playgroud)
此外,删除text/html它,因为它已默认为gzip压缩.
nginx.conf你的应用程序的最终结果应该没有http指令,只是upstream和server.