node.jsservercloud

Node.js "Server listening on port 3000", but I can't view it in browser?


I am trying to get a simple node app running. It works fine on my localhost, but as soon as I am trying to get it to run on my cloud server, it doesn't work. When I do "node app.js" in the right path I get my console.log Express server started on port %s', server.address().port and it also says that it is port 3000(Express server started on port 3000). When I change the server.listen to another port, it displays the right port.

Now when I try to get it running via my domain or via my ip(for example xx.xxx.xx.xx:3000) or my domain (my-domain.com:3000) in both cases it doesn't work. I think I don't quite get the concept and I tried to search for a billion different things, but I can't find the solution to my problem. Could someone tell me, if I need to setup something else, too?


Solution

  • Propably your cloud hosting provider doesn't have the port open for access. Try port 80 which is usually open.