1.安装homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.通过homebrew安装nginx
brew search nginx
brew install nginx
安装完以后,可以在终端输出的信息里看到一些配置路径:
/usr/local/etc/nginx/nginx.conf (配置文件路径)
/usr/local/var/www (服务器默认路径)
/usr/local/Cellar/nginx/1.12.2_1 (安装路径)
3.Nginx 默认8080端口,这时已经可以访问了:
localhost:8080