[英]ruby sinatra remote connection
I'm trying to get hello world working remotely in sinatra: 我正在尝试让您好世界在sinatra中远程工作:
require 'sinatra'
get '/' do
"hello world"
end
locally it works fine: 在本地工作正常:
curl localhost:4567
hello world
but when I try to access it remotely, I get a 404 error. 但是当我尝试远程访问它时,出现404错误。 The server is visible; 服务器是可见的; I have other web applications running just fine (but not on nonstandard ports). 我有其他运行良好的Web应用程序(但不在非标准端口上运行)。 this is a near-stock ubuntu install so there aren't any iptables rules that would block access to port 4567. Is there something I'm missing? 这是一个将近库存的ubuntu安装,因此没有任何iptables规则会阻止对端口4567的访问。我缺少什么吗? I've had difficulty googling this. 我在使用谷歌搜索时遇到了困难。
I assume this is not firewall issue. 我认为这不是防火墙问题。 Add bind set :bind, '0.0.0.0'
something like below 添加绑定set :bind, '0.0.0.0'
如下所示
#app.rb
require 'sinatra'
set :bind, '0.0.0.0'
get "/" do
"Working"
end
to run this 运行这个
ruby app.rb
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.