Blogger Information
Blog 143
fans 1
comment 0
visits 440501
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
[emerg] bind() to 0.0.0.0:XXXX failed (13: Permission denied)
弘德誉曦的博客
Original
1208 people have browsed it

系统启动Nginx后,报 [emerg] bind() to 0.0.0.0:XXXX failed (13: Permission denied)错误的处理方式,分为两种:

第一种:端口小于1024的情况:

[emerg] bind() to 0.0.0.0:1883 failed (13: Permission denied)

原因是1024以下端口启动时需要root权限,所以sudo nginx即可。

第二种:端口大于1024的情况:

[emerg] bind() to 0.0.0.0:8380 failed (13: Permission denied)

这种情况,需要如下操作:

首先,查看http允许访问的端口:

semanage port -l | grep http_port_thttp_port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000

其次,将要启动的端口加入到如上端口列表中

semanage port -a -t http_port_t -p tcp 1883

如此即可解决如上问题。

cenos7安装semanage命令参考

yum -y install policycoreutils-python.x86_64

然后停止nginx服务

systemctl stop nginx

指定配置文件

nginx -c /etc/nginx/nginx.conf 
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post