解决Mac nginx问题 [emerg] 54933#0: bind() to 0.0.0.0:80 failed (13: Permission denied)

Posted 凌乱的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决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 






以上是关于解决Mac nginx问题 [emerg] 54933#0: bind() to 0.0.0.0:80 failed (13: Permission denied)的主要内容,如果未能解决你的问题,请参考以下文章

nginx 问题解决nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)解决

nginx: [emerg] getpwnam(“www”) failed

nginx: [emerg] no events section in configuration

nginx 启动报错 nginx: [emerg] getgrnam("root") failed

nginx安装 nginx: [emerg] getpwnam(“www”) failed 错误