renderings
Install
Find available versions with brew search nginx
Install nginx with brew install nginx
// 查看brew列表
(base) 192:~ bennyrhys$ brew list
==> Formulae
erlang libtiff nginx
// 查看版本
nginx -v
nginx version: nginx/1.21.3
path and configuration
// html文件根目录
(base) 192:www bennyrhys$ cd /usr/local/var/www
(base) 192:www bennyrhys$ ls
50x.html index.html
// 配置文件
/usr/local/etc/nginx/nginx.conf
// 启动文件
/usr/local/etc/nginx/servers
/usr/local/etc/nginx/nginx.conf (配置文件路径)
/usr/local/var/www (服务器默认路径)
/usr/local/Cellar/nginx/1.17.8(安装路径)
Common commands
进入安装路径 cd /usr/local/Cellar/nginx/1.17.8/bin
启动 sudo ./nginx
重启 sudo ./nginx -s reload
关闭 sudo ./nginx -s stop
判断配置文件是否正确 sudo ./nginx -t
nginx停止 首先查询nginx主进程号 ps -ef|grep nginx
正常停止 sudo kill -QUIT 主进程号
快速停止 sudo kill -TERM 主进程号
brew方式启动nginx brew services start nginx
更简单的启动 nginx
access
Visit localhost:8080, successful installation shows that
the effect picture has changed the port nginx.conf
uninstall
After brew uninstall nginx can be checked