I'm an iOS developer primarily. In building my current app, I needed a server that would have a REST API with a couple of GET requests. I spent a little time learning Ruby, and landed on using Sinatra, a simple web framework. I can run my server script, and access it from a browser at localhost:4567, with a request then being localhost:4567/hello, as an example.

Here's where I feel out of my depth. I setup an Ubuntu droplet at DigitalOcean, and felt my way around to setting up all necessary tools via command line, until I could again run my server, now on this droplet.

The problem then is that I couldn't then access my server via droplet.ip.address:4567, and a bit of research lead me to discovering I need Passenger and an Apache HTTP Server to be setup, and not with simple instructions.

I'm way in over my head here, and I don't feel comfortable. There must be a better way for me to take my small group of ruby files and run this on a server, than me doing this. But I have no idea what I'm doing.

Any help or advice would be greatly appreciated.


The problem is that Sinatra default binds to "localhost" which is only accessible from the same "ip".If you try to access from outside the droplet, you would need to bind it to Of course, my answer is only valid for development environments. If you configure as a productive environment, the instructions you mentioned shall be followed.

Regarding how to configure to bing to, you can find more information here http://www.sinatrarb.com/configuration.html.

:bind - server hostname or IP address String specifying the hostname or IP address of the interface to listen on when the :run setting is enabled. The default value in the development environment is 'localhost' which means the server is only available from the local machine. In other environments the default is '', which causes the server to listen on all available interfaces.

To listen on all interfaces in the development environment (for example if you want to test from other computers in your local network) use:

set :bind, ''

I learnt this the hard way but with Rails, I wrote about it here (http://pietro.menna.net.br/recurse-center/2015/07/27/vagrant-rails-net-issues/).

Since both rely on Rack, this commit https://github.com/rack/rack/commit/28b014484a8ac0bbb388e7eaeeef159598ec64fc caused the change in Sinatra & Rails (and any other Web framework which depends on Rack) to have this behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.