macos 从不同的计算机访问 Rails 开发服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10078454/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Access Rails Development Server From A Different Computer
提问by Tyler DeWitt
I'm using webrick to develop my rails app on Mac OS X Lion. I'm trying to access the site from another computer (for testing). The internal IP of my computer is 10.1.10.100.
我正在使用 webrick 在 Mac OS X Lion 上开发我的 rails 应用程序。我正在尝试从另一台计算机访问该站点(用于测试)。我电脑的内部IP是10.1.10.100。
Accessing 10.1.10.100
displays the page served by the apache server running on my computer.
访问10.1.10.100
显示由我的计算机上运行的 apache 服务器提供的页面。
Accessing 10.1.10.100:3000
times out, both from my computer and from another computer on the same network. I can ping 10.1.10.100
. From my computer, loaclhost:3000
displays the app.
10.1.10.100:3000
从我的计算机和同一网络上的另一台计算机访问超时。我能ping通10.1.10.100
。在我的电脑上,loaclhost:3000
显示该应用程序。
Is there are firewall I need to open up on Mac OS X or some other setting that needs to be applied?
我是否需要在 Mac OS X 上打开防火墙或需要应用一些其他设置?
Thanks
谢谢
回答by Kumar Akarsh
While starting the webrick server specify the IP on which your rails application will run (10.1.10.100 in your case) using -b option, it binds Rails to the specified IP.
在启动 webrick 服务器时,使用 -b 选项指定运行 rails 应用程序的 IP(在您的情况下为 10.1.10.100),它将 Rails 绑定到指定的 IP。
rails server -b 10.1.10.100 -p 3000