5

我正在尝试让 hello world 在 sinatra 中远程工作:

require 'sinatra'

get '/' do
  "hello world"
end

在本地它工作正常:

curl localhost:4567
hello world

但是当我尝试远程访问它时,出现 404 错误。服务器可见;我有其他 Web 应用程序运行良好(但不是在非标准端口上)。这是一个近乎库存的 ubuntu 安装,因此没有任何 iptables 规则会阻止对端口 4567 的访问。我缺少什么吗?我很难用谷歌搜索这个。

4

1 回答 1

8

我认为这不是防火墙问题。添加绑定set :bind, '0.0.0.0'如下

#app.rb
require 'sinatra'
set :bind, '0.0.0.0'
get "/" do
    "Working"
end

运行这个

ruby app.rb
于 2013-03-28T06:23:31.047 回答