Mac安装Nginx
...小于 1 分钟
Mac安装Nginx
安装
brew install nginx
结果如下:
==> Installing nginx
==> Pouring nginx--1.21.6.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.6: 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;
➜ ~
配置信息
文档根目录
/usr/local/var/www
默认配置文件:
/usr/local/etc/nginx/nginx.conf
默认端口设置成了 8080
,这样是为了不用sudo来启动
nginx的安装路径:
/usr/local/Cellar/nginx/1.21.6**
启动Nginx
brew services start nginx
重启Nginx
brew services restart nginx
非后台启动
/usr/local/opt/nginx/bin/nginx -g daemon off
停止Nginx
brew services stop nginx
Powered by Waline v2.14.9