配置环境
- MacOS Monterey 12.0.1
1. 安装 Nginx
brew install nginx
Tips:需要安装brew
2. 启动 Nginx
nginx
3.停止 Nginx
sudo nginx -s stop #快速停止命令
sudo nginx -s quit #平稳退出命令
Tips:更多命令可输入nginx -h
查看。
Nginx 启动后,默认端口为 8080 , 可直接通过浏览器访问:http://localhost:8080/
即可
4. 配置 Nginx
/usr/local/etc/nginx/nginx.conf (配置文件路径)
/usr/local/var/www (服务器默认路径)
5. 更新 Nginx
nginx -s reload #重新加载配置文件命令
如需配置Nginx域名转发 请查看文章Mac 配置Nginx域名转发