mac 上安裝 nginx 需要借助 HomeBrew
1房待、安裝 HomeBrew
- 命令行運行
由于官網(wǎng)的安裝路徑總是安裝失敗并徘,所以推薦選擇清華大學或者其他鏡像掠兄,按照提示操作
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
- 重啟終端并運行
source /Users/macbookpro/.zprofile
- 測試是否安裝成功
brew -v
2晌纫、安裝 nginx
- 命令行運行
brew install nginx
- 查看是否安裝成功
nginx -t
- nginx 相關(guān)文件所在目錄,通過 nginx -V 查看撤摸,結(jié)果如下
configure arguments:
# 靜態(tài)資源
--prefix=/usr/local/Cellar/nginx/1.27.2
# 腳本命令
--sbin-path=/usr/local/Cellar/nginx/1.27.2/bin/nginx
--with-cc-opt='-I/usr/local/opt/pcre2/include -I/usr/local/opt/openssl@3/include'
--with-ld-opt='-L/usr/local/opt/pcre2/lib -L/usr/local/opt/openssl@3/lib'
# 配置文件
--conf-path=/usr/local/etc/nginx/nginx.conf
--pid-path=/usr/local/var/run/nginx.pid
--lock-path=/usr/local/var/run/nginx.lock
--http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp
--http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp
--http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp
--http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp
--http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp
--http-log-path=/usr/local/var/log/nginx/access.log
--error-log-path=/usr/local/var/log/nginx/error.log
--with-compat --with-debug --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module
--with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module
--with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_v3_module --with-ipv6 --with-mail
--with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module