macOS 安装 Nginx

macOS Nginx About 1,960 words

Homebrew

brew install nginx

输出

❯ brew install nginx
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/services).
No changes to formulae.

==> Downloading https://ghcr.io/v2/homebrew/core/nginx/manifests/1.23.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/nginx/blobs/sha256:dd146745e55a270c49ccbe7db443c597f918ef6b6713cbb584d44d101b9e9a82
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:dd146745e55a270c49ccbe7db443c597f918ef6b6713cbb584d44d101b9e9a82?se=2023-06-30T06%3A40%3A00Z&sig=ooH19
######################################################################## 100.0%
==> Pouring nginx--1.23.2.arm64_ventura.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.23.2: 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`).
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/fendoudebb/Library/Logs/Homebrew/telnet... (64B)
Pruned 0 symbolic links and 1 directories from /opt/homebrew

启动 Nginx

nginx

热加载配置

nginx -s reload

停止 Nginx

nginx -s stop

测试配置是否正确

nginx -t

默认配置文件

/opt/homebrew/etc/nginx/nginx.conf

默认日志目录

/opt/homebrew/var/log/nginx

默认资源文件目录

/opt/homebrew/var/www
Views: 575 · Posted: 2023-10-19

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh