1. 先安装homebrew
2. 安装Nginx,终端下执行:
$ brew install nginx
安装过程中会自己安装依赖:
3. 启动nginx服务
$ nginx
成功后,使用浏览器打开http://localhost:8080 。
4. nginx文件目录
nginx安装文件目录
/usr/local/Cellar/nginx
nginx配置文件目录
/usr/local/etc/nginx
config文件目录
/usr/local/etc/nginx/nginx.conf
系统hosts位置
/private/etc/hosts
5. 卸载nginx
$ brew uninstall nginx