node.jsdigital-oceandedicated-server

Dedicated Server says This site can't be reached - NodeJs


I have created Node Js API with mongoDB and on port 5000. It is working well in local PC. But when I upload to server and run the program, I am unable to access that API in local PC, it says "This site can't be reached". But the program also running smoothly on server.

The server installed with: - Node - Mongo - Git And Port 5000 rule added in firewall.


Solution

  • run following command in your linux server iptables -t nat -A OUTPUT -o lo -p tcp --dport 5000 -j REDIRECT --to-port 80 It will redirect 5000 to 80 but my advice is to open 5000 in your firewall.