啊哈哈哈哈哈哈
首先在mac中安裝brew,通過它來安裝nginx
brew install nginx
nginx #啟動nginx
nginx -s quit #快速停止nginx
nginx -V #查看版本,以及配置文件地址
nginx -v #查看版本
nginx -s reload|reopen|stop|quit #重新加載配置|重啟|快速停止|安全關閉nginx
nginx -h #幫助
nginx安裝文件目錄
open /usr/local/Cellar/nginx
nginx配置文件目錄
open /usr/local/etc/nginx
config文件目錄
open /usr/local/etc/nginx/nginx.conf
系統hosts位置
open /private/etc/hosts
如果報如下的錯誤,表示你沒有權限,加上 sudo 便可
Nginx啟動報錯:could not open error log file: open() "/usr/local/nginx/logs/error.log" failed
如果發現安裝成功了能打印版本但是依舊不能運行,嘗試找到 cd 到 nginx下運行