MacOS

nginx 在 mac 电脑下安装 nginx

2024-10-27  本文已影响0人  暴躁程序员

mac 上安装 nginx 需要借助 HomeBrew

1、安装 HomeBrew

  1. 命令行运行
    由于官网的安装路径总是安装失败,所以推荐选择清华大学或者其他镜像,按照提示操作
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
  1. 重启终端并运行
source /Users/macbookpro/.zprofile
  1. 测试是否安装成功
brew -v

2、安装 nginx

  1. 命令行运行
brew install nginx
  1. 查看是否安装成功
nginx -t
  1. nginx 相关文件所在目录,通过 nginx -V 查看,结果如下
configure arguments:

# 静态资源
--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
上一篇下一篇

猜你喜欢

热点阅读