Mac 开机自启动 Nginx 和 PHP

Jackey 其他 3,722 次浏览 , , 没有评论

1. 开机启动nginx:
在 /Library/LaunchDaemons/ 目录新建 org.macports.nginx.plist 文件:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
  3. http://www.apple.com/DTDs/PropertyList-1.0.dtd >
  4. <plist version="1.0">
  5. <dict>
  6. <key>Label</key>
  7. <string>org.macports.nginx</string>
  8. <key>ProgramArguments</key>
  9. <array>
  10. <string>/usr/local/bin/nginx</string>
  11. </array>
  12. <key>KeepAlive</key>
  13. <true/>
  14. </dict>
  15. </plist>

加载配置:launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist

2. 开机启动php:
在 /Library/LaunchDaemons/ 目录新建 org.php.php-fpm.plist 文件:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
  3. http://www.apple.com/DTDs/PropertyList-1.0.dtd >
  4. <plist version="1.0">
  5. <dict>
  6. <key>Label</key>
  7. <string>org.php.php-fpm</string>
  8. <key>ProgramArguments</key>
  9. <array>
  10. <string>/usr/sbin/php-fpm</string>
  11. </array>
  12. <key>KeepAlive</key>
  13. <true/>
  14. </dict>
  15. </plist>

加载配置:launchctl load -w /Library/LaunchDaemons/org.php.php-fpm.plist

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Go