使用brew安装nginx
java
brew install nginx
![](https://i-blog.csdnimg.cn/direct/9a3bc70498724d0cabea1c7b42bf6b94.png)
查看nginx信息
java
brew info nginx
![](https://i-blog.csdnimg.cn/direct/317b370b568d4cbbb11072afd2eceac2.png)
启动nginx
java
brew services start nginx
![](https://i-blog.csdnimg.cn/direct/ba605ba1e488407bb4b4137d3b580fe2.png)
验证是否启动成功
浏览器输入地址:127.0.0.1:8080
停止服务
java
brew services stop nginx
![](https://i-blog.csdnimg.cn/direct/e7578cf7e7b8419c9570b8015808aab1.png)
进入nginx文件目录
java
cd /opt/homebrew/etc/nginx
![](https://i-blog.csdnimg.cn/direct/657908a135f64069ac5eedb16b3a8f35.png)
重启服务
java
brew services restart nginx
![](https://i-blog.csdnimg.cn/direct/dc0f5ccda5df4fddb6b8afa4a6858adf.png)