Mac 下nginx 自启动解决

分类:Nginx |

报错如下: 

2019/12/16 17:55:29 [warn] 30070#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/etc/nginx/nginx.conf:2

2019/12/16 17:55:29 [emerg] 30070#0: bind() to 0.0.0.0:80 failed (13: Permission denied)

2019/12/16 17:55:58 [emerg] 30702#0: bind() to 0.0.0.0:80 failed (13: Permission denied)

2019/12/16 17:57:43 [emerg] 32316#0: bind() to 0.0.0.0:80 failed (13: Permission denied)

2019/12/16 17:57:46 [emerg] 32522#0: bind() to 0.0.0.0:80 failed (13: Permission denied)

2019/12/16 18:03:39 [emerg] 37045#0: bind() to 0.0.0.0:80 failed (13: Permission denied)


 

解决方法: 

sudo chown root:wheel /usr/local/opt/nginx/bin/nginx

sudo chmod u+s /usr/local/opt/nginx/bin/nginx

brew services restart nginx