我正在使用nginx和乘客进行rails部署。 在nginx配置文件中,我想让nginx与用户组“deployers”的用户“deployer”一起运行。所以我将用户配置更改为
# /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 :(得分:0)
nginx.conf
的全局参数包含user
。使用此参数配置运行工作进程的用户和组。将其更改为您想要的并重新启动。