无法访问本地 Rails 服务器

CWC*_*CWC 5 macos ruby-on-rails ruby-on-rails-4

我在 mac OS 中构建了一个 rails 应用程序,并尝试使用其他设备(在同一个私有局域网中)连接到这个本地服务。但是我的设备无法访问这个 url => " http://192.168.1.107:3000 "

我的控制台如下:

chris$ rails server --binding=192.168.1.107
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://192.168.1.107:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Run Code Online (Sandbox Code Playgroud)

它在“ http://localhost:3000 ”和“ http://192.168.1.107:3000 ”本地机器上都可以正常工作,但其他设备仍然无法访问“ http://192.168.1.107:3000

有什么建议吗?多谢!

Lau*_*ens 7

尝试这个:

rails server -b 0.0.0.0 -p 3000
Run Code Online (Sandbox Code Playgroud)

如果防火墙阻止 3000 试试这个:

rails server -b 0.0.0.0 -p 80
Run Code Online (Sandbox Code Playgroud)

现在访问 [your-computer-ip]:80

您还可以使用https://localtunnel.me/ 之类的服务(如果您不在同一个本地域中)