nodejs/express app can't serve on port 5000

Posted October 30, 2014 11.7k views

Hi there,

I wonder if anyone have same problem with Ubuntu 14.04.

I am writing a backend nodejs/express app that listen to port 5000 and interact when receives http put/get request. The app starts and runs fine. but I cannot access that port from another computer. First I thought it was nginx problem but I can access the regular http 80 port.

what gives?

I also check the ufw and Iptable, both are inactive(default setting). Domain name resolution also works fine.

Hope anyone with brighter mind can help.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

You need to make sure your app is configured to listen on the public interface:

  • I can’t seem to use port 5000 with anything, I noticed this while using flask which defaults to 5000. I can set the port to ‘anything’ but 5000 and it will work fine but 5000 specifically won’t work externally (I can open up another ssh session and wget localhost:5000 fine). The same applies for nodejs. Running 'sudo netstat -plutn’ shows the same output (beside the port number changing) no matter what the port, and the applications don’t output anything abnormal on the server side.

  • I also just tried creating a new droplet and doing nothing but installing flask/nodejs to ensure it wasn’t something to do with the settings of my existing one, but the outcome was the same. Apps work fine on other ports (5001, 4999, 3000 etc) but I am unable to access port 5000 still.