brew services restart nginx
Stopping nginx
... (might take a while)
==> Successfully stopped nginx
(label: homebrew.mxcl.nginx)
==> Successfully started nginx
(label: homebrew.mxcl.nginx)nginx
可是實際上沒啓動成功,查看下錯誤日誌bash
tail -n 10 /usr/local/var/log/nginx/error.log
2018/01/25 10:56:53 [emerg] 54933#0: bind() to 0.0.0.0:80 failed (13: Permission denied)
2018/01/25 10:57:40 [emerg] 55281#0: bind() to 0.0.0.0:80 failed (13: Permission denied)
2018/01/25 11:20:22 [emerg] 62763#0: bind() to 0.0.0.0:80 failed (13: Permission denied)
2018/01/25 11:20:48 [emerg] 63020#0: bind() to 0.0.0.0:80 failed (13: Permission denied)rest
查看看端口占用狀況:日誌
sudo lsof -i:80
沒發現異常,忽然想到以前安裝過kong,會使用openresty,而openresty 又自帶一個nginx,因此先卸載掉(準備使用minikube來運行kong)
但仍是不行。code
可是把80換成8080端口就能夠,最後看到一篇文章(找不到連接了)裏的方法搞定:homebrew
sudo chown root:wheel /usr/local/Cellar/nginx/1.12.2_1/bin/nginx sudo chown root:wheel /usr/local/Cellar/nginx/1.12.2_1/bin/nginx