【发布时间】:2016-04-20 21:01:00
【问题描述】:
我正在使用 CentOS 在 VPS 上部署一个 rails 应用程序。我已经用gem install passenger 安装了乘客。为了安装 nginx,我使用了rvmsudo passenger-install-nginx-module。
在我设置的 nginx 配置文件中:
server {
listen 80;
server_name my-ip-address;
location / {
root /home/deploy/repos/application-name/public;
passenger_enabled on;
rails_env production;
}
...
}
当我执行sudo service nginx status 时,我得到以下信息:
nginx (pid 21015 21014) is running...
这表明 nginx 正在运行。
但我在浏览器上收到This webpage is not available。
即使我在开发模式下使用rails s 安装rails 服务器并尝试使用my-ip-address:3000 在浏览器中签入时也得到相同的结果
谁能帮忙解决可能的问题?
当我运行命令passenger-config restart-app 时,结果是:
Phusion Passenger is currently not serving any applications
我需要关于这是 nginx 还是乘客的问题的建议?
还有一个问题是-
如果我的乘客没有正确安装但 nginx 安装正确,那么我能看到“欢迎使用 nginx 页面”吗?
更新:
我尝试运行passenger start -p 3000 -d -e production,由该乘客在后台提供服务。现在,如果我这样做passenger-status,我会得到两个乘客实例,其中一个说Phusion Passenger is currently not serving any applications,另一个显示如下:
Version : 5.0.21
Date : 2016-01-16 10:42:42 +0530
Instance: feOajf7V (nginx/1.8.0 Phusion_Passenger/5.0.21)
----------- General information -----------
Max pool size : 6
App groups : 1
Processes : 1
Requests in top-level queue : 0
----------- Application groups -----------
/home/deploy/repos/application-name/public (production):
App root: /home/deploy/repos/application-name
Requests in queue: 0
* PID: 22003 Sessions: 0 Processed: 0 Uptime: 4m 17s
CPU: 0% Memory : 36M Last used: 4m 17s ago
如果我运行passenger-config restart-app,我得到的结果是:
Please select the application to restart.
‣ /home/deploy/repos/application-name/public (production)
Cancel
这是否意味着乘客工作正常?但我在浏览器中看到webpage not available。
【问题讨论】:
-
把这篇文章通读一遍,你就会掌握它的窍门:digitalocean.com/community/tutorials/…
-
对不起,我没有在问题中提到,但我已经按照同一篇文章安装 nginx 和乘客,并且还包含了 nginx 管理脚本。
标签: ruby-on-rails ruby ruby-on-rails-4 nginx passenger