【问题标题】:Nginx configuration of user用户的Nginx配置
【发布时间】:2014-06-10 22:47:32
【问题描述】:

我正在使用 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 error of no gem detected 导致出现这个错误页面。

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.

【问题讨论】:

  • nginx.conf中的用户是什么?
  • 对不起,您的意思是“没人”吗?它带有默认的 nginx.conf
  • 这是默认配置 #user nobody; worker_processes 4; #error_log 日志/error.log; #error_log 日志/error.log 通知; #error_log 日志/error.log 信息; #pid 日志/nginx.pid;

标签: ruby-on-rails ruby nginx


【解决方案1】:

nginx.conf 具有包含user 的全局参数。使用此参数配置运行工作进程的用户和组。将其更改为您想要的并重新启动。

【讨论】:

  • 是的巴拉,我也理解这就是为什么我将其修改为用户部署者部署者;
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-06-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-11
相关资源
最近更新 更多