Skip to content

Mac os安装nginx

shell
-> % brew install nginx
==> Fetching nginx
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/nginx-1.25.5.monter
######################################################################### 100.0%
==> Pouring nginx-1.25.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 start nginx now and restart at login:
  brew services start 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.25.5: 26 files, 2.5MB
==> Running `brew cleanup nginx`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).