Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

When I run the following command:

lsof -i:8080

This is the result:

node    32419 root    6u  IPv4 122865       TCP localhost.localdomain:webcache (LISTEN)

That result is different from that of the following command:

lsof -i:80

Result:

nginx   32029  root    6u  IPv4 121546       TCP *:http (LISTEN)
nginx   32030 nginx    6u  IPv4 121546       TCP *:http (LISTEN)

Nginx is : "TCP *", but node's process "localhost.localdomain". What does it mean, localhost.localdomain? Does it means the process can access from localhost only?

I have trouble accessing the node process from another server via 8080 port.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

in the first case nginx listens only on the loopback interface; 127.0.0.1 is resolved to localhost.localdomain thru /etc/hosts in the second case nginx listens on all the available interfaces (notice *:http)

so the answer is yes, it can be accessed from the local host only;

you can add "-n" flag to lsof to see ip addresses instead of the names those may be resolved to.

share|improve this answer
    
so can I change node's process into TCP:* like nginx? –  augustin Mar 28 '11 at 10:22
    
yes you can, you have to configure "node" to listen on all available interfaces if this is what you want. so i'm not sure what "node" is. if "node" does not support listener configuration then you can do some tricks from either iptables or ipfw/pf (not sure what your OS is) to redirect the traffic destined for node to localhost –  sysfault Mar 28 '11 at 10:28
    
node is nodejs Hello World, example code. nodejs.org , nothing special configuration, just simple 6 line code. hm... so you mean I have find out the solution in node module~ –  augustin Mar 28 '11 at 10:35
    
snip: this piece of code: isten(8124, "127.0.0.1"); put "0.0.0.0" instead of "127.0.0.1" –  sysfault Mar 28 '11 at 10:37
1  
127.0.0.0/8 is defined by iana to be used for local purposes only. this class will never be routed outside your router (well unless you force it to ;) ) nor the router will accept requests coming to this address. putting it simple, you can't access that ip address from outside your host. "0.0.0.0" means "listen to all the available interfaces on this host" –  sysfault Mar 28 '11 at 10:51

Port 8080 is just listening locally (on localhost).

Port 80 (shown as http) is listening on ALL bound IP addresses on port 80.

share|improve this answer
    
For clarity: you're relatively safe with port 8080 being bound to localhost so there's nothing to worry about. HTH, JR –  Jonathan Ross Mar 28 '11 at 10:07
    
jonathan, but I have to connect node's module from another server. but, I can't. That's the real problem~ -_-; –  augustin Mar 28 '11 at 10:23

Your Answer

 
discard

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.