mac nginx 安装 配置 启动 开机启动

1 安装
brew install nginx

2 启动
/usr/local/opt/nginx/bin/nginx
-s reload
-s stop

3 配置一个host
/usr/local/etc/nginx/nginx.conf
server {
listen 80;
server_name localhost;
root /Users/eli/Documents/svn/test;
index index.html;
}

4 开机启动
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.17.3_1/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
sudo chown root:wheel /usr/local/Cellar/nginx/1.10.1/bin/nginx
sudo chmod u+s /usr/local/Cellar/nginx/1.10.1/bin/nginx

5 查看错误日志
/usr/local/Cellar/nginx/1.17.3_1/logs/error.log
可以在 /usr/local/etc/nginx/nginx.conf 修改配置

6 其他配置
都有详细的介绍
https://www.runoob.com/w3cnote/nginx-setup-intro.html
http://www.nginx.cn/76.html

你可能感兴趣的:(mac nginx 安装 配置 启动 开机启动)