2013-07-23 25 views
0

下面是來自sinatra website's recipe for hosting sinatra with nginx and unicorn推薦的nginx配置文件的一個片段。需要注意的是,從一個典型的nginx設置不同的兩件事情:爲什麼sinatra nginx配方只推薦1名工人?

  1. 只有1個工作進程指定
  2. accept_mutex,通常在默認情況下是關閉

是什麼原因,只有1工人?如果我們指定更多,會發生什麼?

accept_mutex off純粹是因爲只有一名工人,或者是有其他原因嗎?

# this sets the user nginx will run as, 
#and the number of worker processes 
user nobody nogroup; 
worker_processes 1; 

# setup where nginx will log errors to 
# and where the nginx process id resides 
error_log /var/log/nginx/error.log; 
pid  /var/run/nginx.pid; 

events { 
    worker_connections 1024; 
    # set to on if you have more than 1 worker_processes 
    accept_mutex off; 
} 
+0

它與這兩者之間的關係可能沒有任何關係,只是寫這篇教程的人使用單個處理器的機器(通常是用Nginx爲每個內核分配一個工作進程)。 –

+0

啊,這很有道理。並關閉互斥體,然後從只有一名工作人員...如果你想改變你的評論一個答案我會接受它。 – Jonah

+0

完成,很高興我能幫上忙! –

回答

1

它可能沒有任何與兩者之間的關係,只是誰寫的教程採用的是單處理器的機器(通常你每個核心分配一個工作進程nginx的)的事實。

相關問題