一、先装置 brew
国内疾速装置 homebrew 参考这篇文章
https://zhuanlan.zhihu.com/p/…
二、装置 nginx
应用命令 brew install nginx
装置最新版本的 nginx
三、保留 nginx 的装置信息
==> nginx
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx 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 nginx
Or, 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