mac 通过brew安装nginx

安装 nginx

brew install nginx

安装完成控制台的打印信息

aaron@AarondeMacBook-Pro develop % brew install nginx
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/pcre2-10.39.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/nginx-1.21.6_1.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for nginx: pcre2
==> Installing nginx dependency: pcre2
==> Pouring pcre2-10.39.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pcre2/10.39: 230 files, 6.0MB
==> Installing nginx
==> Pouring nginx-1.21.6_1.arm64_monterey.bottle.tar.gz
==> Caveats
Docroot is: /opt/homebrew/var/www

The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /opt/homebrew/etc/nginx/servers/.

To restart nginx after an upgrade:
  brew services restart nginx
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/nginx/bin/nginx -g daemon off;
==> Summary
🍺  /opt/homebrew/Cellar/nginx/1.21.6_1: 26 files, 2.2MB
==> Running `brew cleanup nginx`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> nginx
Docroot is: /opt/homebrew/var/www

The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /opt/homebrew/etc/nginx/servers/.

To restart nginx after an upgrade:
  brew services restart nginx
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/nginx/bin/nginx -g daemon off;

启动nginx

brew services start nginx

重启

brew services restart nginx

关闭

brew services stop nginx

根据控制台输出的信息可知
配置文件的路径
/opt/homebrew/etc/nginx/nginx.conf
默认加载文件的路径
nginx will load all files in /opt/homebrew/etc/nginx/servers/.

加载文件的路径是在 nginx.conf 最后一行配置的

include servers/*;

设置只加载配置文件

include servers/*.conf;

查看安装目录,及配置文件目录

brew info nginx 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值