启动时没有在启动时加载nginx

我用自制软件安装了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/

相关文章

最近做自动化测试时,深感自己对前端涉猎太少,加上对这块比...
homebrew本身就是一个git仓库。使用homebrew安装软件包时,会...
一、Homebrew安装、卸载等命令Homebrew的安装和卸载都非常简...
在mac系统中,使用homebrew可以很方便的管理包。按照官网的说...
我按照说明从这里使用brew安装mysqlhttps://gist.github.com...
我在macOS10.12.4上安装了nginx1.10.3和php5.5.38作为开发服...