Setup of firewall and router

We need to open the traffic from internet to the Mac Nginx server through the router. We need to open the http and https ports from the router and then open the Mac firewall to the Nginx.


Here we use the ASUS router. Login to the router and allow the Port Forwarding for http (80) and https (443). The "local IP" is the IP address of your Mac computer in the local network.


Apple Mac OS firewall

Next we need to open the firewall on Mac so that the traffic can go from internet to the router and further to the Mac. There is a problem in the Mac firewall logging (the logs are empty) and this is a known bug. Type the following commands on the terminal window

$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --remove /usr/path_to_nging/bin/nginx
$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --add /usr/path_to_nging/bin/nginx
$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --unblockapp /usr/path_to_nging/bin/nginx
$ sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

Now the ports and firewalls should be open from internet to the Nginx. Make sure that the Nginx server is up and running and you may test your connection, for example, using the tool

Return to the Mac main page.