nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)错误解决办法

ginx: the configuration file /home/work/local-qc/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
nginx: configuration file /home/work/local-qc/nginx/conf/nginx.conf test failed

原因:当前用户对该位置没有写入权限

解决办法一:
1.使用命令:sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 以root权限启动

2.使用命令:sudo chmod -R a+rw /usr/local/nginx 给所有用户赋权限(个人学习,不考虑安全问题)

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 启动Nginx

 

注:以非root权限启动时,会出现 nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied) 错误

原因:Linux只有root用户可以使用1024一下的端口

解决办法二:
1.已root权限启动

2.将 /usr/local/nginx/conf/nginx.conf 文件中的80端口改为1024以上

server {
# listen 80

listen 8080

……

}

posted @ 2021-10-19 15:09  张亮java  阅读(5212)  评论(0编辑  收藏  举报