2

I'm trying to test a web site being served via nginx on my Mac. Things work just fine accessing the server on that same Mac, but when I try to get to it from a couple of Windows machines on the same WAN via the Mac's IP address, I can never get further than "This page cannot be displayed." I'm pretty sure this used to work…

Both using IE and Telnet on the Windows machines to try to get to my server is failing. However, if I turn on Windows sharing in the Network pane of OS X's System Preferences, I can access the filesystem, so I know that it's not that my entire Mac is inaccessible.

I thought it might be a firewall thing, but I checked and confirmed that my wifi router doesn't have its firewall enabled. OS X has a firewall, but nginx has a hole poked in it, and completely disabling the OS X firewall doesn't help anything at any rate.

On my Mac, I can see that nothing is being added to either nginx's error or access logs when I try to access the server from the Windows machines, so I assume whatever is failing is happening in the network layer.

I'm a networking newbie and at a loss of what to try next. Any tips on what to try next would be appreciated.

  • check that nginx listening not only on local interface – kofemann Apr 23 '13 at 7:50
1

I am not a nginx specialist, but the webserver may only be listening on the loopback interface (127.0.0.1) and not on your ethernet interface. Try listening on * to match all the interfaces.

More info here : http://wiki.nginx.org/HttpCoreModule#listen

1

You can check to see if the server is listening on all available IP addresses by using the NETSTAT command. Here is a link that shows you how to do this (there are lots around, just google):

http://od-eon.com/blogs/calvin/list-open-ports-mac-os-x/

You want to make sure something is listening on either IP address 0.0.0.0 (which means all available IP's) or your network IP

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN

If you don't see something like that then you'll probably need to check the nginx is configured to bind itself to all available IP addresses. To do this you'll need to look at the config files which will most likely be called nginx.conf (mine is found in /opt/nginx/conf, yours might be different) and also the sites.conf file (often vhosts are stored here).

In one of these files you should have a server section that is wrapped in curly braces. Inside here you should see a listen directive. It should hopefully say something like

listen 80;

If it doesn't could you post the configs so we can see them?

If you've check the two above items and you have something listening on port 80 and nginx is configured to listen to requests then we'll have to do some extra debugging!

  • lsof is showing that nginx is listening on all IP addresses for port 80, and I don't see anything in nginx's config which says otherwise - all "listen" bits are followed simply by 80. (I'm using perusio's config with adaptations to get it working on OS X.) – Garrett Albright Apr 24 '13 at 4:22
  • As you have some network connectivity from your client to your Mac you could try running a network traffic analyzer (on both the client and Mac). For the Mac you can use TCPDUMP from the console (sudo tcpdump port 80) and from the Windows machines you can use Wireshark (wireshark.org). When run on the server, you will need to them browse to the website from your client. Hopefully you should see some traffic. If you don't then there are other issues we need to look for. – Gareth Hastings Apr 24 '13 at 11:25

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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