无法通过本地网络访问 sinatra 应用程序 [英] Cannot access sinatra app through the local network

查看:50
本文介绍了无法通过本地网络访问 sinatra 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Rails 应用程序.如果我使用 rails s(端口 3000)启动它,它可以通过 IP 地址(在我的情况下为 192.168.0.3)在我的机器和本地网络上的每个设备上完美运行.
我有 sinatra 应用程序.如果我使用 ruby app.rb(端口 4567)启动它,它可以在我的机器上完美运行,但无法从本地网络上的其他设备访问它.

I have rails application. If I start it with rails s (port 3000), it works perfectly both on my machine and every device on my local network via the ip address (192.168.0.3 in my case).
I have sinatra application. If I start it with ruby app.rb (port 4567), it works perfectly on my machine, but it it is not accessible from other devices on my local network.

两个应用程序都使用 Thin 作为应用程序服务器.

Both application use Thin as an app server.

是否与 sinatra 的工作方式有关?

Is it something related to how sinatra works?

推荐答案

尝试 ruby app.rb -o 0.0.0.0ruby app.rb -e production.要么应该工作.

Try ruby app.rb -o 0.0.0.0 or ruby app.rb -e production. Either should work.

这篇关于无法通过本地网络访问 sinatra 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆