从另一台计算机访问Rails开发服务器 [英] Access Rails Development Server From A Different Computer
问题描述
我正在使用Webrick在Mac OS X Lion上开发我的Rails应用程序.我正在尝试从另一台计算机访问该站点(以进行测试).我的计算机的内部IP是10.1.10.100.
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.
访问10.1.10.100
显示由我的计算机上运行的apache服务器提供的页面.
Accessing 10.1.10.100
displays the page served by the apache server running on my computer.
从我的计算机和同一网络上的另一台计算机访问10.1.10.100:3000
均超时.我可以ping 10.1.10.100
.在我的计算机上,loaclhost:3000
显示该应用程序.
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.
在Mac OS X上是否需要打开防火墙或需要应用其他设置?
Is there are firewall I need to open up on Mac OS X or some other setting that needs to be applied?
谢谢
推荐答案
启动Webrick服务器时,使用-b选项指定将在其上运行Rails应用程序的IP(在您的情况下为10.1.10.100),它将Rails绑定到指定的IP.
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.
rails server -b 10.1.10.100 -p 3000
这篇关于从另一台计算机访问Rails开发服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!