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

I have this in my nginx.conf

server {
      listen 80;
      server_name localhost;
      root /opt/myapp/public;
      passenger_enabled on;
}

The problem is I can access the webapp from the computer on which it's running, but not from any other computer in the network. Any ideas?

Running on CentOS 5.6

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

'server_name localhost' makes nginx require the Host header to be 'localhost', ie require that the client is trying to reach it using 'http://localhost' and thus only work on localhost itself :-).

Either do not enter a server_name, or use one that the other hosts will recognize it with (fqdn, IP etc).

http://wiki.nginx.org/VirtualHostExample

share|improve this answer
    
Thanks for pointing that out. That does clear some things. Seems though that my problem was actually because of CentOS. The firewall was blocking everything, nginx was working fine –  andrew Jun 11 '11 at 10:59
add comment

It should be listening on all interfaces with that config, you can check if it's indeed listening on all interfaces with the following command

netstat -aln | grep 80

The result should look like this (Taken from one of my servers)

tcp    0      0 0.0.0.0:80           0.0.0.0:*            LISTEN

If that matches, you should check if you have a firewall enabled on the server, if so you need to open TCP port 80 on it.

share|improve this answer
add comment

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.