环境运维

nginx在mac下设置自启动(非homebrew)

安装目录:/usr/local/nginx 

sudo vim /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/nginx/sbin/nginx</string>

    <key>KeepAlive</key>
    <true/>

    <key>NetworkState</key>
    <true/>

    <key>LaunchOnlyOnce</key>
    <true/>
  </dict>
</plist>

再设置启动:sudo launchctl load -w /Library/LaunchDaemons/nginx.plist

重启后,输入localhost,看到了熟悉的网页,心情爆好!

参考网址
https://blog.csdn.net/sunny243788557/article/details/106022903/