我将一个 RoR 应用程序部署到我的服务器,并带有一个额外的 Apache2 虚拟主机文件:
<VirtualHost *:80>
# ServerName ubuntu
DocumentRoot /var/www/myapp/current/public
PassengerEnabled off
ProxyPass / http://127.0.0.1:9051
ProxyPassReverse / http://127.0.0.1:9051
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect all requests to the maintenance page if present
RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
</IfModule>
</VirtualHost>
我使用Passenger启动它:
passenger start -a 127.0.0.1 -p 9051 -e production -d
这是一个 Ubuntu 服务器:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise
端口正在监听:
plee@ubuntu:~$ sudo lsof -i :9051
[sudo] password for plee:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 1016 plee 4u IPv4 168135 0t0 TCP localhost:9051 (LISTEN)
nginx 1017 plee 4u IPv4 168135 0t0 TCP localhost:9051 (LISTEN)
nginx 1017 plee 5u IPv4 225556 0t0 TCP localhost:9051->localhost:44586 (ESTABLISHED)
ruby 1018 plee 5u IPv4 225555 0t0 TCP localhost:44586->localhost:9051 (ESTABLISHED)
问题是,我的应用程序只能由http://localhost:9051
如果我尝试使用服务器的 IP 地址从另一台机器连接:http://10.50.10.75:9051
谷歌浏览器给了我:
Google Chrome could not connect to 10.50.10.75:9051
请帮帮我!
谢谢。