nginx - Launchd 在启动时未加载 nginx

标签 nginx plist homebrew launchd

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

关于nginx - Launchd 在启动时未加载 nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27553688/

相关文章:

ruby-on-rails - 使用 Nginx 和 Puma 在 Ruby on Rails 应用程序上启用 SSL

bash - 如何为 brew 配方实现安装或升级?

mysql - 从 Homebrew 安装中禁用 MySQL "secure-file-priv"选项

ruby-on-rails - 如何让 Nginx 和 Phusion Passenger 维护两个 Rails 实例之间的 session ?

Nginx,如何允许DOMAIN :PORT and IP:PORT requests

php - Nginx 和 PHP-FPM - 权限被拒绝 - Windows

objective-c - 在服务器上编辑 Plist

ios - 按下按钮时打开 Facebook 应用程序页面。 swift 5

ios - 当 root 是数组然后是字典时,plist 到 tableview

node.js - 警告 : node-5. 0.0 已经安装,只是没有链接