mac安装参考地址
https://cloud.tencent.com/developer/article/1695765
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$ brew search nginx
==> Formulae
nginx
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$ brew install nginx
==> Downloading https://ghcr.io/v2/homebrew/core/pcre/manifests/8.45
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre/blobs/sha256:5e5cc7a5bf8bb6488ec57d4263bf6b0bc89e93252a0a2460f846de29373162d8
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:5e5cc7a5bf8bb6488ec57d4263bf6b0bc89e93252a0a2460f846de29373162d8?se=2022-05-06T23%3A05%3A00Z&sig=kZcMlUugjqzmUfikiQPm
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/nginx/manifests/1.21.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/nginx/blobs/sha256:a802faf81a6346a929963f56a7c6316014eaa93cce626c060b78574c36609322
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:a802faf81a6346a929963f56a7c6316014eaa93cce626c060b78574c36609322?se=2022-05-06T23%3A05%3A00Z&sig=KdgQIj4twyF4Gzg6zylm
######################################################################## 100.0%
==> Installing dependencies for nginx: pcre
==> Installing nginx dependency: pcre
==> Pouring pcre--8.45.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/pcre/8.45: 204 files, 5.7MB
==> Installing nginx
==> Pouring nginx--1.21.5.monterey.bottle.tar.gz
==> Caveats
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/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:
/usr/local/opt/nginx/bin/nginx -g daemon off;
==> Summary
🍺 /usr/local/Cellar/nginx/1.21.5: 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: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/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:
/usr/local/opt/nginx/bin/nginx -g daemon off;
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$ nginx -v
nginx version: nginx/1.21.5
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$
gaoxinfudeMacBook-Pro:nginx-1.6.2 gaoxinfu$