0

当我在 localhost:3000/somecontroller 的机器上启动一些应用程序时。如果我尝试 mymachineip:3000/somecontroller 是否可以公开?对不起,如果是一个愚蠢的问题......

4

2 回答 2

1

Rails 应用程序默认为 listen on 0.0.0.0:3000,这实际上只是意味着“在端口 3000 上侦听所有接口”。所以是的,您应该能够通过其 IP 地址从另一台机器访问它。(如果你在你的机器上运行防火墙或任何东西,你可能需要打开端口)。

于 2012-05-10T15:32:43.293 回答
0

You have to configure the firewall to allow access to your machine. Your router has a public IP. You can figure the public IP out, if you go to http://whatismyipaddress.com/, or so similar site.

Then you can configure your firewall to allow access to your machine. Open your router settings, and open a port to your local machine IP. http://www.wikihow.com/Set-up-Port-Forwarding-on-a-Router

It's also a good idea to give the machine a static IP, bc the IP can change when the machine restarts.

于 2012-05-10T15:33:41.297 回答