使用 brew install nginx 安装nginx 

mac 安装nginx_加载

 

查看nginx配置文件目录   
open /usr/local/etc/nginx/

查看ginx被安装到的目录 
open /usr/local/Cellar/nginx  

 

  • 启动服务
    sudo nginx (直接nginx启动,可能会报错)或者 sudo brew services start nginx, 端口默认是8080,通过界面访问 http://localhost:8080,看到NG环境界面说明已经安装成功
  • 关闭服务
    sudo nginx -s stop 或者 sudo brew services stop nginx
  • 重新加载
    nginx -s reload