[nginx] mac 安裝 nginx
- 安裝 nginx
- brew install nginx
- 安裝完的資訊:
- Docroot is: /usr/local/var/www
- The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. nginx will load all files in /usr/local/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
- 開機自動啟動 nginx
- sudo brew services start nginx
- Warning: Taking root:admin ownership of some nginx paths:
- /usr/local/Cellar/nginx/1.17.9/bin
- /usr/local/Cellar/nginx/1.17.9/bin/nginx
- /usr/local/opt/nginx
- /usr/local/opt/nginx/bin
- /usr/local/var/homebrew/linked/nginx
- This will require manual removal of these paths using `sudo rm` on
- brew upgrade/reinstall/uninstall.
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
- Nginx 相關指令
- # 啟動 nginx服務
- sudo nginx
- # 重新載入配置|重啟|停止|退出 nginx
- nginx -s reload|reopen|stop|quit
- #測試配置是否有語法錯誤
- nginx -t
- 查看 nginx 相關設置
- brew info nginx
- 查看 nginx 設定
- nginx -V
- # 啟動 nginx服務