mac nginx设为开机启动
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
·
在mac上装好nginx环境,想设为开机自动启动。但是linux上的方式不适用于mac。只能利用Mac系统里的Launchctl来做这个事。
1、新建文件
sudo vim /Library/LaunchDaemons/com.nginx.plist
加入
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.nginx.plist</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/nginx/sbin/nginx</string>
</array>
<key>KeepAlive</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/usr/local/nginx/logs/error.log</string>
<key>StandardOutPath</key>
<string>/usr/local/nginx/logs/access.log</string>
</dict>
</plist>
2、修改权限
sudo chmod 644 /Library/LaunchDaemons/com.nginx.plist
3、注册为系统服务
sudo launchctl load -w /Library/LaunchDaemons/com.nginx.plist
卸载为sudo launchctl unload -w /Library/LaunchDaemons/com.nginx.plist
4、重启后查看nginx是否启动
normanygtekimbp:LaunchDaemons normanyang$ ps -ef | grep nginx
0 169 1 0 3:07下午 ?? 0:00.00 nginx: master process /usr/local/nginx/sbin/nginx
0 170 169 0 3:07下午 ?? 0:00.00 nginx: worker process
501 928 399 0 3:43下午 ttys000 0:00.00 grep nginx
已经启动了,成功!
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。
更多推荐



所有评论(0)