Starting Nginx on every start is boring. Lets start it on start up automatically. To start Nginx on startup in MacOS Monterey (version 13.2), you can follow the steps mentioned in my previous response, with the exception of the launch agent configuration file contents. Here's an updated version that should work:


Create a launch agent configuration file:

sudo nano /Library/LaunchAgents/nginx.plist


Add the following contents to the file:

<?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>ProgramArguments</key>
    <array>
      <string>/usr/local/bin/nginx</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/dev/null</string>
    <key>StandardOutPath</key>
    <string>/dev/null</string>
    <key>KeepAlive</key>
    <true/>
  </dict>
</plist>


Load the launch agent:

sudo launchctl load /Library/LaunchAgents/nginx.plist

Useful Tags :