我正在为我的Rails应用程序(Mac OS X 10.11)设置Passenger和Nginx。 我使用了以下命令:
gem install passenger
rvmsudo passenger-install-nginx-module
所有这些都已完美安装。
在.bash_profile
中添加了nginx路径:
export PATH=$PATH:/opt/nginx/sbin/
我的nginx conf:
passenger_root /Users/MyUserName/.rvm/gems/ruby-2.2.5@rails4115/gems/passenger-5.3.4;
passenger_ruby /Users/MyUserName/.rvm/gems/ruby-2.2.5@rails4115/wrappers/ruby;
server {
listen 443;
ssl on;
server_name app1-local.staging.com;
rails_env development;
passenger_enabled on;
root /Users/MyUsername/Desktop/Github/MainApp/public;
ssl_certificate /opt/nginx/ssl/mainapp.com.crt;
ssl_certificate_key /opt/nginx/ssl/mainapp.com.key;
}
server {
listen 443;
ssl on;
server_name app2-local.staging.com app3-local.staging.com app4-local.staging.com local.staging.com;
rails_env development;
passenger_enabled on;
root /Users/MyUsername/Desktop/Github/MainApp2/public;
ssl_certificate /opt/nginx/ssl/mainapp.com.crt;
ssl_certificate_key /opt/nginx/ssl/mainapp.com.key;
}
server {
listen 80;
server_name app1-local.staging.com;
rails_env development;
passenger_enabled on;
root /Users/MyUsername/Desktop/Github/MainApp/public;
}
server {
listen 80;
server_name app2-local.staging.com app3-local.staging.com app4-local.staging.com local.staging.com;
rails_env development;
passenger_enabled on;
root /Users/MyUsername/Desktop/Github/MainApp2/public;
}
此后,我启动了nginx:sudo nginx
,它可以正常工作。现在,如果我访问local.staging.com
,则会收到502内部服务器错误。
Nginx错误日志显示:
upstream prematurely closed connection while reading response header from upstream
如果我做passenger-status
,它将输出:
Phusion Passenger is currently not serving any applications.
注意:运行时,passenger-config validate-install
命令显示Everything looks good. :-)
编辑
sudo passenger-memory-stats
的输出:
-------- Apache进程--------
----------- Nginx进程------------
62366 1 2411.6 MB 1.3 MB nginx:主进程nginx
63016 62366 2411.6 MB 1.5 MB nginx:工作进程
63008 28339 2377.8 MB 0.3 MB结尾-f /opt/nginx/logs/error.log
------乘客流程------
36415 0.0 MB 0.0 MB(PassengerAgent)
63010 2416.8 MB 3.3 MB乘客看门狗
63014 2417.6 MB 3.3 MB客运客机路由器
63602 2457.3 MB 5.7 MB乘客核心
编辑2 现在进入nginx error.log,获取:
Process aborted! signo=SIGSEGV(11), reason=#0, signal sent by PID 0 with UID 0, si_addr=0x0, randomSeed=1534502322
和
upstream prematurely closed connection while reading response header from upstream
这里有帮助吗?