Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey everyone, I'm sure this is very noobish, so forgive me. I'm trying to run a node.js server on port 8080 of my ubuntu 10.04.

Here's the result of iptables -L on the server:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

And here's the result of nmap -p 8080 (edited the ip address because everything is or should be wide open)

nmap -p 8080 -A

Starting Nmap 5.00 ( ) at 2011-05-19 22:52 PDT
Interesting ports on xxx (
8080/tcp closed http-proxy

Why on earth is 8080 seen as closed? Adding this did not help:

iptables -A OUTPUT -p tcp  --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp  --dport 8080 -j ACCEPT

I'm really confused.

I'll add this, in case it helps, but I don't know

 netstat -pan | grep 80
tcp        0      0*               LISTEN          16785/node      
tcp        0      0    *               LISTEN      16471/apache2

I can access my regular website running off of port 80 on apache, but the node.js server is inaccessible from outside. Accessing it from the server itself works fine.

So my question is: how would I go about debugging this? Could there be something else than iptables blocking some ports? How do I find out what it is?

Any help much appreciated!

share|improve this question
up vote 16 down vote accepted

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');
share|improve this answer
I suspected that, but never came across a before, so disregarded it. I applied your fix, and that did it, thanks! – Mikael Gramont May 20 '11 at 6:39
I also have this problem. I followed this code but my nodejs server is still not accessible from outside. – xybrek Nov 5 '11 at 2:44
Yeah, same here. – hayavuk Sep 13 '13 at 7:55

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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.