一、先装置brew
国内疾速装置homebrew参考这篇文章
https://zhuanlan.zhihu.com/p/...
二、装置nginx
应用命令brew install nginx装置最新版本的nginx
三、保留nginx的装置信息

==> nginxDocroot is: /usr/local/var/wwwThe default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so thatnginx can run without sudo.nginx will load all files in /usr/local/etc/nginx/servers/.To have launchd start nginx now and restart at login:  brew services start nginxOr, if you don't want/need a background service you can just run:  nginx

如果想开机后盾运行:brew services start nginx
不想开机运行:nginx
四、常用命令

启动 nginx #浏览器拜访 127.0.0.1 测试是否胜利启动 重启 nginx -s reload 进行 nginx -s stop查看版本 nginx -v