Skip to content

Instantly share code, notes, and snippets.

@rowanmanning
Last active December 21, 2015 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowanmanning/6229176 to your computer and use it in GitHub Desktop.
Save rowanmanning/6229176 to your computer and use it in GitHub Desktop.
nginx port 80 firewall hack thing

All assumes you're running nginx on port 8080. Change ports to suit your needs.

  1. Copy ipfw.plist into /Library/LaunchDaemons/ipfw.plist
  2. Copy ipfw.conf into /etc/ipfw.conf

If you want this to work straight away, you may need to run:

$ sudo launchctl load /Library/LaunchDaemons/ipfw.plist

Also, maybe restart a couple of times. This has worked for me but might do nothing for you :)

# Forward port 80 to 8080
add fwd 127.0.0.1,8080 tcp from any to me dst-port 80 in
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ipfw</string>
<key>Program</key>
<string>/sbin/ipfw</string>
<key>ProgramArguments</key>
<array>
<string>/sbin/ipfw</string>
<string>/etc/ipfw.conf</string>
</array>
<key>RunAtLoad</key>
<true />
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment