解決Mac nginx問題 [emerg] 54933#0: bind() to 0.0.0.0:80 failed (13: Permission denied)


brew services restart nginx

Stopping nginx... (might take a while)
==> Successfully stopped nginx (label: homebrew.mxcl.nginx)
==> Successfully started nginx (label: homebrew.mxcl.nginx)

但是實際上沒啟動成功,查看下錯誤日志

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)

查看看端口占用情況:

sudo lsof -i:80

沒發現異常,突然想到之前安裝過kong,會使用openresty,而openresty 又自帶一個nginx,所以先卸載掉(准備使用minikube來運行kong)
但還是不行。

但是把80換成8080端口就可以,最后看到一篇文章(找不到鏈接了)里的方法搞定:

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 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM