Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Receiving ERR_CONNECTION_REFUSED after Sinatra deployment on Digital Ocean

Having a problem with deployment of a small Sinatra app that works fine locally, and seems like its running on digital ocean, but can't be hit via the domain name. The following is the message I receive:

This webpage is not available

Error code: ERR_CONNECTION_REFUSED

The following is what's displayed on my droplet using rackup -p 80, which to me indicates it should be able to be hit:

Thin web server (v1.6.3 codename Protein Powder)

Maximum connections set to 1024

Listening on localhost:80, CTRL+C to stop

If it makes any difference, I also cannot hit the ip address directly. Anyone encounter similar problems or possibly a solution? The app is on ubuntu uses psql as a database. It would be greatly appreciated. Thanks!

like image 771
Zac Messinger Avatar asked Feb 11 '23 17:02

Zac Messinger


1 Answers

Bind your app on 0.0.0.0 instead of localhost:

ruby your_app.rb -o 0.0.0.0 or rackup --host 0.0.0.0

In production, you should setup a reverse proxy (eg. using nginx or apache) to bind a domain to your app internal port insteal of opening everything on 0.0.0.0

like image 91
Habax Avatar answered Mar 05 '23 16:03

Habax