我使用两个rails应用程序,在本地运行rails s和zeus s -p3001。当我试图在另一台机器上运行我的应用程序时,用webbrick启动的服务器在另一个系统上运行良好,但无法运行zeus。请帮帮我。
我只是在浏览器192.168.1.111:3000
(运行)中给出了url。和
`192.168.1.111:3001` (server not found).
我试了zeus s -b 192.168.1.111:3001
,但没有帮助我
问题是,zeus绑定到本地地址(127.0.0.1),禁止从remove主机连接。正确的解决方案是使用apache2或nginx设置反向代理。
- http://glasz.org/2013/10/25/reverse-proxy-a-rails-app.html
- https://www.digitalocean.com/community/tutorials/how-to-deploy-rails-apps-using-unicorn-and-nginx-on-centos-6-5
或者你也可以使用防火墙来重定向请求。
- http://forum.slicehost.com/index.php?p=/discussion/2497/iptables - -港- 80重定向到港口——8080/p1
但是一个快速而肮脏的解决方案是使用SSH端口转发,像这样:
- 在远程机器的端口3000上启动zeus
-
本机
local-machine$ ssh -L 3001:localhost:3000 remote-machine
-
本地机器:连接
localhost:3001
而不是remote-machine:3000