4

在为我正在处理的项目执行 git clone 后,我将我的 rails 更新为 nitrous 和 Rails 4.2.0.beta2 运行 rails server

=> Booting WEBrick                                                                                                                                                                                                    
=> Rails 4.2.0.beta2 application starting in development on http://localhost:3000                                                                                                                                     
=> Run `rails server -h` for more startup options                                                                                                                                                                     
=> Ctrl-C to shutdown server                                                                                                                                                                                          
[2014-12-02 20:13:56] INFO  WEBrick 1.3.1                                                                                                                                                                             
[2014-12-02 20:13:56] INFO  ruby 2.1.4 (2014-10-27) [x86_64-linux]                                                                                                                                                    
[2014-12-02 20:13:56] INFO  WEBrick::HTTPServer#start: pid=495 port=3000                                                                                                                                              
^C[2014-12-02 20:14:48] INFO  going to shutdown ...                                                                                                                                                                   
[2014-12-02 20:14:48] INFO  WEBrick::HTTPServer#start done.  

我去3000端口

 We couldn't find a server running on this port – are you sure there is a server running?
Make sure to bind your server to host 0.0.0.0 (instead of localhost/127.0.0.1).

我究竟做错了什么?

4

1 回答 1

4

第一次在 Nitrous.io 上设置 Rails 项目时遇到了同样的问题。问题是您需要将服务器 IP 从 localhost:3000 更改为 0.0.0.0:3000。

为此,您必须在 nitrous 命令行窗口中更改 rails 服务器设置。尝试这个:

rails server -b, --binding=0.0.0.0

这会将 Rails 服务器设置更改为 0.0.0.0。当您再次启动 rails 服务器时,它应该可以工作。这是我的工作解决方案。

您可以在此站点上找到有关进行此类更改的信息:http: //smyck.net/2007/03/11/how-to-bind-webrick-to-any-ip-address/或在命令行中,使用命令:

rails server -h
于 2014-12-28T20:27:36.023 回答