- 安裝
brew install nginx
brew會(huì)自動(dòng)安裝依賴pcre, openssl@1.1送矩,安裝路徑在/usr/local/homebrew/Cellar/下面穗酥,安裝過程提示米酬,提示信息的安裝路徑與啟動(dòng)命令
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile
/usr/local/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/homebrew/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
/usr/local/homebrew/Cellar/nginx/1.10.3: 8 files, 980.9KB, built in 1 minute 37 seconds
- nginx.conf
- 安裝完成后灾常,如果在nginx.conf修改root的路徑舌仍,有可能會(huì)報(bào)403,需要chmod修改root指向目錄的權(quán)限
- 如果開啟日志泰偿,需要在
/usr/local/homebrew/Cellar/nginx/1.10.3下面創(chuàng)建logs目錄
- 啟動(dòng)命令
第1次啟動(dòng)用命令nginx -s reload熄守,重啟會(huì)碰到pid文件錯(cuò)誤,需要用下面的命令
sudo /usr/local/homebrew/Cellar/nginx/1.10.3/bin/nginx
sudo /usr/local/homebrew/Cellar/nginx/1.10.3/bin/nginx -s reload