Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

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
up vote 8 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).

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

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 *            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

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.