一、brew安装Nginx
- 安装
brew install nginx
- 查看安装信息
brew info nginx
二、Nginx启动和停止
1.启动服务:sudo nginx
2.停止服务:sudo nginx -s stop
三、其它常用命令
sudo nginx 启动服务
sudo nginx -s reload 重新加载
sudo nginx -s reopen 重新启动
sudo nginx -s quit 退出(处理完事情走)
open /opt/homebrew/etc/nginx/ 查看nginx安装目录
四、Nginx配置及路径
1、基本路径
1.网站存放路径
/opt/homebrew/var/www
2.Nginx配置文件路径
/opt/homebrew/etc/nginx/nginx.conf
3.服务配置文件
/opt/homebrew/etc/nginx/servers/
4.后台进程守护,如果您不想要/不需要后台服务,您可以运行:
/opt/homebrew/opt/nginx/bin/nginx -g守护进程关闭;
2、Nginx配置—待编辑ing
Nginx配置文件路径
/opt/homebrew/etc/nginx/nginx.conf
服务配置文件
/opt/homebrew/etc/nginx/servers/
五、My Mac 提示及配置文件路径
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;
// 翻译:
// Docroot是:/opt/homebrew/var/www
// 默认端口已在/opt/homebrew/etc/nginx/nginx中设置。配置为8080,以便
// nginx可以在没有sudo的情况下运行。
// nginx将加载/opt/homebrew/etc/nginx/servers/中的所有文件。
// 要在升级后重新启动nginx,请执行以下操作:
// brew服务重新启动nginx
// 或者,如果您不想要/不需要后台服务,您可以运行:
// /opt/homebrew/opt/nginx/bin/nginx -g守护进程关闭;
链接来源:http://www.mjdg.store/articles/2022/12/03/1670062521772.html
标签:opt,sudo,nginx,etc,Nginx,brew,homebrew,安装 From: https://www.cnblogs.com/hefeng2014/p/17104183.html