来自:http://hushicai.com/2013/09/21/mac-os-x-xia-nginx-kai-ji-zi-qi-dong.html
按照apple developer官网所说的,用户的开机自启动任务一般都需要在以下目录建立一个plist文件:
/Library/LaunchDaemons/我们在
/Library/LaunchAgents/
~/Library/LaunchAgents/
/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>
launchctl load /Library/LaunchDaemons/nginx.plist成功!