macOS 下开机自启动nginx
问题描述: mac重启后,手动启动nginx太麻烦 解决: 加入开机自启动 (1)homebrew安装nginx后,安装目录下有一个 homebrew.mxcl.nginx.plist 文件,在Mac系统上, .plist文件就是服务开机启动的配置文件。 (2)由于nginx监听80端口,必须在开机启动的时候,以管理员权限执行,所以需要将此文件复制一份置于/Library/LaunchDaemons目录之下. (3)然后使用 launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist 加载nginx服务到系统启动服务中 代码: sudo cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist /Library/LaunchDaemons/ sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist 来源: oschina 链接: https://my.oschina.net/falcon10086/blog/4258246