参考文章地址
Homebrew安装nginx
在确保MacOS 安装Homebrew成功以后,执行如下命令
brew install nginx
根据上图可知我本机的几个重要的文件位置:
nginx.conf
配置文件:/opt/homebrew/etc/nginx/nginx.conf
- 静态资源的加载位置:
/opt/homebrew/var/www
- nginx的启动命令:
brew services start nginx
或者/opt/homebrew/opt/nginx/bin/nginx -g daemon off
brew启动Nginx
1、正常启动
brew services start nginx
2、非后台运行
如果期望以“非后台”的形式运行 nginx,则可以使用如下命令:
/opt/homebrew/opt/nginx/bin/nginx -g daemon off;
3、重启Nginx
brew services restart nginx
brew关闭Nginx
brew services stop nginx