Search code examples
node.jsexpressubuntuserverport

How do I make a NodeJs project publicly accessible on port 3000?


I have a NodeJs/Express project in Alibaba cloud based Ubuntu server.

When I run project and access with curl localhost:3000 and curl 127.0.0.1:3000 it works!

When I access with IP public, e.g. curl 192.x.x.x:3000 it doesn't work, even though I have edited config in Express project in some code to : server.listen(3000,"0.0.0.0") OR server.listen("3000","192.x.x.x").

FYI I have Apache on this server. When I access on Internet with IP public no problem. What can I do to solve this problem? Thanks beforehand.

PS: the 192.x.x.x is my IP public and it works access with Apache project


Solution

  • You have to configure your security ground and create a inbound rule to allow port 3000. Follow this guideline.

    https://www.alibabacloud.com/help/doc-detail/25471.htm

    Make sure you allow TCP traffic or all traffic from all sources to the port 3000 as the inbound rule.