OSX launchd

This information taken from Jane Avriette's blog

Save this file as [ /System/Library/LaunchDaemons/nginx.plist]

 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  Label nginx Program /usr/local/sbin/nginx KeepAlive NetworkState StandardErrorPath /var/log/system.log LaunchOnlyOnce

You will want to place this in /System/Library/LaunchDaemons/nginx.plist, and it is helpful to issue

launchctl load -F /System/Library/LaunchDaemons/nginx.plist

after which it should behave correctly. Of course, the corresponding unload command is simply "unload", with or without the -F. Note that this launches nginx on boot, rather than when you choose it to. It also tells it to log stderr to syslog, which may not be to your preference (nginx likes to log to /usr/local/log/nginx.err).