【解决方案】nginx bind() to 0.0.0.0:**** failed (13: Permission denied)

nginx 启动失败,日志里面报错信息如下:

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:**** failed (13: Permission denied)

原因seLinux限制了http的端口

getenforce   这个命令可以查看当前是否开启了selinux 如果输出 disabled 或 permissive 那就是关闭了

如果输出 enforcing 那就是开启了 selinux

方法1、临时关闭selinux

setenforce 0    ##设置SELinux 成为permissive模式

setenforce 1    ##设置SELinux 成为enforcing模式

方法2、永久关闭selinux,

修改/etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

重启机器即可

方法3:添加seLinux允许的http端口


1、查看端口是否加入seLinux允许的http端口
      semanage port -l | grep http_port_t
2、添加端口
      semanage port -a -t http_port_t -p tcp 8090

如果出现 semanage command not found错误就执行
      yum -y install policycoreutils-python
 

发布了147 篇原创文章 · 获赞 88 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/zpwangshisuifeng/article/details/103854655