IP address not responding

March 29, 2018 321 views
Getting Started Deployment Node.js Ubuntu 16.04

IP for domain is assigned as

Created hello.js file as follows:

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

and started with command "node hello.js"

server starts at 8080

Entering URL: gets error:

Site cannot be reached refused to connect.

How should I fix this? Help please!

1 Answer

Have you tried while the server is running? You appear to have mistyped it above.

Make sure that your node application is binding to 8080 and that you either don't have a firewall running that is restricting the port or that you have made the appropriate exemption in the firewall for your external IP.

Have another answer? Share your knowledge.