macOS Launchd¶
Plist Configuration¶
Save as /Library/LaunchDaemons/nginx.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>nginx</string>
<key>Program</key>
<string>/usr/local/sbin/nginx</string>
<key>KeepAlive</key>
<true/>
<key>NetworkState</key>
<true/>
<key>StandardErrorPath</key>
<string>/var/log/system.log</string>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>
Load the Service¶
sudo launchctl load -F /Library/LaunchDaemons/nginx.plist
Unload the Service¶
sudo launchctl unload /Library/LaunchDaemons/nginx.plist
Note
This launches NGINX automatically on boot. Errors are logged to syslog; NGINX typically logs to /usr/local/var/log/nginx/error.log.