1、使用brew檢視本地安裝了那些軟體
brew list
2、搜尋Nginx是否存在
brew search nginx
3、檢視nginx相關資訊
brew info nginx
1、nginx在本地未安裝
2、nginx來源
3、Docroot 檔案根目錄,代碼存放的檔案夾,預設/opt/homebrew/var/www
4、預設配置檔案位置 /opt/homebrew/etc/nginx/nginx.conf 預設端口8080 這樣nginx就可以在沒有sudo的情況下運作
5、nginx 将要加載的檔案位置 /opt/homebrew/etc/nginx/servers/
4、開始安裝nginx
brew install nginx
安裝過程中,出現Error: Command failed with exit 128: git
解決方式:輸入brew -v 後會提示你執行兩個配置指令,直接複制執行
brew -v
1、2是需要執行的指令,3分别執行兩條指令
5、再次進行安裝,執行安裝指令
brew install nginx
6、M1系統安裝後的配置檔案路徑,及預設端口
/opt/homebrew/etc/nginx/nginx.conf to 8080
M1系統nginx檔案存放路徑
/opt/homebrew/var/www
7、啟動 Nginx,啟動之後打開 http://localhost:8080/ 連結,就會出現 Welcome to nginx!
nginx
8、停止nginx
1、快速停止 nginx -s stop
2、完成所有程式停止 nginx -s quit
9、重新開機
nginx -s reload