I\'ve got a Sinatra \"hello world\" app that I am trying to run using jRuby. It works when I run the app, but not when I run rackup. Can anyone tell me what is going on here?
When you run the Ruby file directly (or when you add Sinatra.run!
to the config.ru
file) Sinatra runs its own server. In this case the call to set :bind, '0.0.0.0' will take effect. When you run through rackup
this setting is ignored.
The default host that rackup listens to is localhost, so the server will only be available through the same machine, you won’t be able to access it from other machines. To access it through other machines set the --host
option:
bundle exec rackup -p4567 --host 0.0.0.0
(Note the output of rackup -h
for the current version says the default host is 0.0.0.0, but this is out of date and has been fixed in master.)