Question

I have a server running CentOs 6.3 with the latest version of node installed on it. when I execute this code

var http = require('http');

var server = http.createServer(function (request, response) {
    console.log('c');
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.end("Hello World\n");
});
    server.listen(80,"0.0.0.0",function(){
        console.log(this._connectionKey);
    });
// Put a friendly message on the terminal
console.log("Server running");

I get the following messages: Server running 4:0.0.0.0:80 so far so good, that mean the server should be running. But, when I try to access the site via the ip the host company gave me I get a "not found" message. I tryend also ommiting the Ip, changing it to 127.0.0.1 and even to the external Ip. I also changed the port to 1337 and gurnisht, it didnt help.

P.S. This code sample is a test to check what is wrong, I have a more complex server using express with the same problem.

Tnx

Was it helpful?

Solution

well I found the problem. I had my firewall still working. I simply stopped the iptables

service iptables stop
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top