在Mac電腦終端使用命令brew install nginx或者brew update都報如下錯誤:
Error: homebrew-core is a shallow clone. homebrew-cask is a shallow clone. To `brew update`, first run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow These commands may take a few minutes to run due to the large size of the repositories. This restriction has been made on GitHub's request because updating shallow clones is an extremely expensive operation due to the tree layout and traffic of Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you automatically to avoid repeatedly performing an expensive unshallow operation in CI systems (which should instead be fixed to not use shallow clones). Sorry for the inconvenience!
兜兜轉轉找了好多帖子,最后還是按照字面提示進行操作。分別執行如下兩條命令。時間較長,耐心等待。
為了避免意外,我是在 # cd /usr/local/Homebrew/目錄下執行的操作命令。如果有小伙伴嘗試在其他位置操作命令也可以得到正確結果的話,可以留言分享下結果。
# git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
# git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
mac 使用brew安裝nginx 各種命令
安裝:brew install nginx 或者 sudo brew install nginx
啟動:brew services start nginx 或者 sudo brew services start nginx
重啟:brew services restart nginx 或者 sudo brew services restart nginx
停止:brew services stop nginx 或者 sudo brew services stop nginx
查看:cat usr/local/etc/nginx/nginx.conf
編輯:vi usr/local/etc/nginx/nginx.conf
查看安裝目錄:brew list nginx
nginx -s reload: 修改配置后重新加載生效
nginx -s stop : 快速停止
nginx nginx -s quit: 完整有序的停止nginx
nginx: 啟動nginx