Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed nginx using ports and started it with sudo. Accessing the nginx welcome page from localhost works perfectly, however accessing it from an external computer fails.

Doing an nmap on the computer from the outside reveals

80/tcp   filtered http

So clearly the mac firewall is blocking the port. I then proceed to add the nginx executable to the firewall exception list as seen in this image, however the nmap still shows up as port 80 being filtered and I'm unable to access the webpage. The exact binary that is in the list is /opt/local/sbin/nginx which to my knowledge seems correct

Any ideas what I should do? Thanks!

P.S. Turning the firewall off does allow me to access the website from the outside world, however that isn't an ideal solution.

share|improve this question
    
I don't have an answer, but here are a couple of things to look at: check /var/log/appfirewall.log to see if it has anything useful, and run sudo lsof -i:80 to make sure it's really nginx doing the listening (and that it's listening on all IPs, not just 127.0.0.1). –  Gordon Davisson Dec 14 '12 at 22:40
    
Hey Gordon, thanks for the suggestions! My firewall log looks like this when I try to connect: Dec 18 02:12:56 MacBook-Pro.local socketfilterfw[80663] <Info>: Deny connecting from my.ip.is.here:55843 to port 80 proto=6 And this is the output of the listening table: nginx 80437 root 6u IPv4 0x35ec104ccb86c175 0t0 TCP *:http (LISTEN) nginx 80438 nobody 6u IPv4 0x35ec104ccb86c175 0t0 TCP *:http (LISTEN) Looks like everything should be correct, but it's still getting blocked :( –  Alex Ionescu Dec 18 '12 at 8:13
    
Is it possible you have two nginx executables, one allowed in the firewall and one not? That's the only thing I can think of... –  Gordon Davisson Dec 18 '12 at 13:11
add comment

2 Answers

This worked for me (OSX 10.9):

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/local/Cellar/nginx/1.4.4/bin/nginx
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /usr/local/Cellar/nginx/1.4.4/bin/nginx

When tried doing it through symlink (to avoid redoing this process when nginx is upgraded), got the following error: The application is not part of the firewall after running:

sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /usr/local/bin/nginx
share|improve this answer
add comment

I've run into this same problem. I suspect it has to do with nginx's master/worker process model confusing Apple's appfirewall implementation.

The solution I've found is to tell appfirewall to allow the nginx process:

$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw -t nginx

I don't recall if this persists across reboots or not. If it doesn't, create a launch plist in /Library/LaunchAgents to do this on boot, if you want.

share|improve this answer
    
This doesn't work on 10.8. It complains that -t is an invalid option. Furthermore, if I add via --add `which nginx`, it adds it, but it doesn't recognize it if I go to remove it with the --remove option. –  Brendan Mar 20 '13 at 21:49
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.