[Nginx] Centos nginx bind() failed permission denied

版权声明:本文为博主原创文章,未经博主允许不得转载。PS: 转载请注明出处 http://blog.csdn.net/ouyangtianhan https://blog.csdn.net/ouyangtianhan/article/details/79815961

cnetos下修改端口成非常规端口出现报错

## 0: bind() to 0.0.0.0:8090 failed (13: Permission denied)
  • 原因seLinux限制了http的端口

    • 方法一:关闭seLinux
修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启。
如果不想重启系统,使用命令setenforce 0
注:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式 
  在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux
  • 方法二:添加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

猜你喜欢

转载自blog.csdn.net/ouyangtianhan/article/details/79815961