I have a Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-63-generic x86_64) server and my public IP is something like 183.xx.xxx.xx (curl -4 icanhazip.com).I have started my rails app using the command:

rails s -b0.0.0.0 -p3002

and puma server has started successfully

    => Booting Puma
    => Rails 5.0.3 application starting in development on http://localhost:3002
    => Run `rails server -h` for more startup options
    Puma starting in single mode...
    * Version 3.9.1 (ruby 2.4.0-p0), codename: Private Caller
    * Min threads: 5, max threads: 5
    * Environment: development
    * Listening on tcp://
    Use Ctrl-C to stop

I tried to access my app in the browser using:


I am getting

This site can’t be reached
172.xx.xxx.xx took too long to respond.

Any help is highly Appreciate.Thanks in Advance!


netstat -plnt

    tcp        0      0 *               LISTEN      -
    tcp        0      0    *               LISTEN      -
    tcp        0      0 *               LISTEN      -
    tcp        0      0*               LISTEN      -
    tcp        0      0  *               LISTEN      25689/
    tcp        0      0*               LISTEN      -

A process is running with a pid 25689

  • Perhaps I'm missing something, but your command starts with port 3002; however, the output shows the server is listening on port 3000. Could this be the issue?
    – schaiba
    Jun 15 '17 at 6:23
  • @schaiba, Thanks for the quick response.I apologize for the typo and I have edited it . Jun 15 '17 at 6:29

First of all, I would check iptables. Executing iptables -L ou should see something like:

ACCEPT     tcp  --  anywhere    anywhere   tcp dpt:3002 ctstate NEW

which means that your firewall allows connection to that port. If you don't, try adding a rule to access to that port with this command:

sudo iptables -A INPUT -p tcp --dport 3002 -j ACCEPT
  • @Luiz , thanks you for your response.I have added running ports list in the edit.I have also adding the rule sudo iptables -A INPUT -p tcp --dport 3002 -j ACCEPT.But i am still unable to access my app in browser Jun 15 '17 at 7:25
  • If you want to completely discard firewall problems you can try to disable firewall with 'sudo iptables -F' and trying again. To restore the firewall, you should just reboot your server. It is very important restoring firewall!
    – Luis Díaz
    Jun 15 '17 at 7:33

Assuming the browser is on the same machine as the server, you're better off using this URL instead:

Accessing your own public IP is usually problematic, since you're generally relying on a fairly complex route. is another name for localhost and is the standard way for connecting to servers on the same machine.

Sometimes servers expect to be accessed by domain name instead. It doesn't look like this is an issue for you, but if you ever go down that route, just add the following line to your /etc/hosts file: your.public.domain.name

Finally, in case you're confused by the appearance of in your netstat table, note that the table lists what interface servers are listening on. Some servers are listening to all interfaces ( while others are only listening to the local interface (

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.