brew 安裝 nginx

  1. 安裝
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

  1. nginx.conf
  • 安裝完成后,如果在nginx.conf修改root的路徑,有可能會(huì)報(bào)403,需要chmod修改root指向目錄的權(quán)限
  • 如果開啟日志,需要在
    /usr/local/homebrew/Cellar/nginx/1.10.3下面創(chuàng)建logs目錄
  1. 啟動(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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容