2013-10-09 46 views
3

我使用的是nginx 1.4.1。在複製unicorn's example of nginx.conf後,我發現這些設置必須移至不同的指令。我仍然無法設置在nginx.conf文件中的以下設置:worker_processes,user,pidevents塊。當我現在將它們放置時,日誌顯示directive is not allowed here。我應該修復什麼?nginx指令在這裏是不允許在麒麟的例子中nginx.conf

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 qwuen { 
    ... 
} 

server { 
    ... 
} 

更新1

我知道這個post,但它的怪異,無論我做的是不工作。我在nginx中找不到任何文檔。

+0

你的'http {'塊與上面的代碼相比在哪裏? – CDub

+0

@CDub,我刪除它。 – Victor

回答

6

原始示例不能直接使用,因爲主配置爲/etc/nginx/nginx.conf/etc/nginx/nginx.confhttp指令,其中包括sites-enabled/*指令。要在/etc/nginx/nginx.conf所做的唯一變化是:

work_processes 4; 
worker_connections 1024; 

而且,從中取出text/html因爲它已經默認gzip壓縮。

您的應用程序中nginx.conf的最終結果應該沒有http指令,只有upstreamserver

相關問題