先安装brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
nginx的安装与配置
brew install nginx
修改配置文件
sudo vim /usr/local/etc/nginx/nginx.conf
#修改默认的8080端口为80
给予管理员权限
sudo chown root:wheel/usr/local/opt/nginx/bin/nginx
sudo chmod u+s/usr/local/opt/nginx/bin/nginx
加入launchctl启动控制
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist~/Library/LaunchAgents/launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
运行nginx
sudo nginx #打开 nginx
nginx