2014-06-10 29 views
1

我正在用nginx和乘客進行rails部署。 在nginx配置文件中,我想讓nginx與usergroup「deployers」的用戶「部署者」一起運行。所以我改變了用戶配置是用戶的Nginx配置

# /opt/nginx/conf/nginx.conf      

user deployer deployers; 
worker_processes 2; 

#error_log logs/error.log; 

但是不管我有多少時間重新啓動該服務,但它仍然由「nobody」用戶運行

任何人都經歷了這一點,並知道如何告訴Nginx的運行與用戶部署者? 由於用戶nginx運行在nobody之下,因此導致此錯誤頁面中未檢測到gem檢測結果的gem錯誤。

Error page: 
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run: 

bundle install 
If that didn't work, then maybe the problem is that your gems are installed to //.rvm/gems, while at the same time you set PassengerRuby (Apache) or passenger_ruby (Nginx) to /usr/local/rvm/gems/ruby-2.1.0/wrappers/ruby. Because of the latter, RVM does not load gems from the home directory. 

To make RVM load gems from the home directory, you need to set PassengerRuby/passenger_ruby to an RVM wrapper script inside the home directory: 

Login as nobody. 
Enable RVM mixed mode by running: 
rvm user gemsets 
Run this to find out what to set PassengerRuby/passenger_ruby to: 
/usr/local/rvm/gems/ruby-2.1.0/wrappers/ruby \ 
/usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.44/bin/passenger-config --detect-ruby 
If that didn't help either, then maybe your application is being run under a different environment than it's supposed to. Please check the following: 

Is this app supposed to be run as the nobody user? 
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use. 
Please check whether the correct RVM gemset is being used. 
+0

'nginx.conf'中的用戶是什麼? – Bala

+0

對不起,你的意思是「沒有人」?它帶有默認的nginx.conf – sovanlandy

+0

這是默認配置 #user nobody; worker_processes 4; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; – sovanlandy

回答

0

nginx.conf具有全局參數,包括user。使用此參數配置工作進程所運行的用戶和組。將其更改爲您想要的並重新啓動。

+0

是的巴拉,那我也明白這就是爲什麼我將它修改爲 用戶部署者部署者; – sovanlandy