简体   繁体   中英

Nodejs on linux not accessible outside Server

tried everything... port 8008 seems to be open but no luck. netstat shows 8008 to be listening

I can do curl localhost:8008 but not from an external machine using the ip address of my server

and yes, i want to host my nodejs on port 8008 (not 8080 - im using 8080 for something else)

netstat output:

tcp 0 0 0.0.0.0:8008 0.0.0.0:* LISTEN

Have you tried changing your port

var port = process.env.PORT || 8008;   //server.listen(3000, '0.0.0.0');
app.listen(port, 0.0.0.0, function() {
  console.log("Listening on " + port);
});

If you have .env insert value PORT=8008

and run your server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM