生产环境中的Phusion Passenger + NGINX
我已经像往常一样用我的ROR应用程序做了一切,但乘客没有使用它。不知道什么是错的......
sudo passenger-config restart-app
Phusion Passenger is currently not serving any applications.
的/ etc / nginx的/位点可用/ MyApp的
server {
listen 80;
server_name _;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/myapp/public;
passenger_app_root /var/www/myapp;
rails_env production;
passenger_enabled on;
passenger_ruby /home/myuserapp/.rvm/gems/ruby-2.3.1/wrappers/ruby;
}
在已启用的网站中有一个软符号链接 myapp 到 / etc / nginx / sites-available / myapp
sudo乘客身份
Version : 5.1.4
Date : 2017-05-25 06:56:30 +0300
Instance: byXevAbZ (nginx/1.10.3 Phusion_Passenger/5.1.4)
----------- General information -----------
Max pool size : 6
App groups : 0
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
但是有一些乘客实例正在运行......
sudo passenger-config list-instances
Name PID Description
--------------------------------------------------------------------------
byXevAbZ 1085 nginx/1.10.3 Phusion_Passenger/5.1.4
答案 0 :(得分:1)
我跑 sudo nginx -t 命令
nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
首先警告我,所以我决定问题是在myapp-site和defult中发生冲突。
所以我只需关闭默认站点并重新启动nginx。一切正常!
sudo rm /etc/nginx/sites-enabled/default
sudo service nginx restart
最终配置文件:
<强>的/ etc / nginx的/位点可用/ MyApp的强>
server {
listen 80;
server_name myapp.com;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/myapp/current/public;
rails_env production;
# Turn on Passenger
passenger_enabled on;
passenger_ruby /home/myuserapp/.rvm/gems/ruby-2.3.1/wrappers/ruby;
}
P.S。如果你更深入地理解这个主题,请纠正我。