最近系统重装,记录一下安装过程吧。
brew install nginx
安装就是这么简单。
查询配置文件位置nginx -t
结果如下:
itkey@itkeydeMacBook-Pro ~ % nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
修改配置以后重启 nginx
nginx -s reload
重启报错解决办法
服务器重启之后,执行 nginx -t 是OK的,然而在执行 nginx -s reload 的时候报错
nginx: [error] invalid PID number “” in “/run/nginx.pid”
解决方法:
需要先执行
nginx -c /etc/nginx/nginx.conf
nginx.conf文件的路径可以从nginx -t的返回中找到。
nginx -s reload
参考文档
https://blog.csdn.net/achang21/article/details/80039561