Node.js is not accessible from external IPs on Ubuntu


Solution 1:

Thanks for adding the last netstat output, it really helped. You can't access node.js from outside because it is listening on localhost IP i.e You need to configure node.js to listen on so it will be able to accept connections on all the IPs of your machine.

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
}).listen(8080, "");
console.log('Server running at');

Solution 2:

According to your netstat output, port 8080 is open only for which is localhost, hence accessing from the server works (which is localhost), but not from anywhere else.

The right output should look like