Rails binding to 'ip':3000 is giving me connection timeout

October 11, 2017 584 views
Ruby on Rails Ubuntu 16.04

Hi im following this tutorial


except that im using Ubuntu 16
The problem is after i bundle install my app, and following the

RAILS_ENV=production rails server --binding=server_public_IP

and try to access it via web app, all i get is errconntimeout

my app is indeed running, and this is what it shows

=> Booting Puma
=> Rails 5.1.4 application starting in production 
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: production
* Listening on tcp://my.ip:3000
Use Ctrl-C to stop

i only followed the instructions on the tutorial and im not yet installing nginx.
Im also quite new on this stuff, i had to rebuild my droplet cause i thought i broke something on my first run as i really can't see my app and now im quite loss

this was also my netstat

Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
tcp        0      0*               LISTEN      112        31543       -               
tcp        0      0    *               LISTEN      0          16055       -               
tcp        0      0 my.ip.:3000*               LISTEN      1000       97890       14743/my.ip.1
tcp        0      0 my.ip.:22      some.ip:42964    ESTABLISHED 0          80263       -               
tcp        0    664 my.ip.:22      some.ip:44726    ESTABLISHED 0          98189       -               
tcp        0      0 my.ip.:22      some.ip:34704     SYN_RECV    0          0           -               
tcp6       0      0 :::22                   :::*                    LISTEN      0          16074       -```
1 Answer

Sorry to see that your question hasn't received an answer yet. Unfortunately, after this much time, it is unlikely that an answer for this specific question will be provided. For people still landing here via search, a good first step would be checking your firewall for any rules blocking connections to port 3000. Sine netstat reports that the program is listening on ip:port properly, that's most likely the culprit.

sudo ufw status


sudo iptables -L

Allow access using:

sudo ufw allow 3000


sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
Have another answer? Share your knowledge.