我用自制软件安装了Nginx然后我得到了信息并按照说明加载了launchd plist
$brew info Nginx
Nginx: stable 1.6.2, devel 1.7.7, HEAD
...
To load Nginx:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.Nginx.plist
Or, if you don't want/need launchctl, you can just run:
Nginx
问题是我重启时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>homebrew.mxcl.Nginx</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/Nginx/bin/Nginx</string>
<string>-g</string>
<string>daemon off;</string>
</array>
<key>WorkingDirectory</key>
<string>/usr/local</string>
</dict>
</plist>
解决方法:
这对我有用:
sudo cp /usr/local/opt/Nginx/*.plist /Library/launchdaemons
sudo launchctl load -w /Library/launchdaemons/homebrew.mxcl.Nginx.plist
The trick to this is that Mac OSX won’t let anything other than “root”
or “system” level services use a port number below 1024.
在这里阅读更多:http://derickbailey.com/2014/12/27/how-to-start-nginx-on-port-80-at-mac-osx-boot-up-log-in/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。