How to bind 80 non-root How to bind 80 non-root nginx nginx

How to bind 80 non-root


Is your concern that you don't want nginx running as root or that you don't have root access?

Nginx has a user config option which will drop root after binding to the port.

If you don't have root access the best solution I know of on OS X is to use pf to setup ip redirection to a non-priviliged port, however you'll still need to get someone with root access to do this.

The config for pf is stored in /etc/pf.conf - I believe that you can simply add rules to this file and reload pf for them to take effect.

rdr pass inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080rdr pass inet proto tcp from any to any port 443 -> 127.0.0.1 port 8081

Then reload pf with sudo pfctl -F all -ef /etc/pf.conf and configure nginx to listen on the ports to redirected to.