一、先安装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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。