Mac下Nginx设置开机自启

步骤

1.创建启动文件夹

mkdir -p ~/Library/LaunchAgents

2.将安装好的nginx复制到创建的文件夹中

cp /usr/local/Cellar/nginx/nginx版本/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/

 

3.设置启动进程并加载启动

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

 

4.修改nginx目录所属权限

sudo chown root:wheel /usr/local/Cellar/nginx/nginx版本/bin/nginx
sudo chmod u+s /usr/local/Cellar/nginx/1.10.1/bin/nginx

你可能感兴趣的:(Mac下Nginx设置开机自启)