安装
rpm -ivh nginxxxx

解决Nginx的connect() to 127.0.0.1:8080 failed (13: Permission denied) while connect

配置nginx:
防火墙设置:selinux
安装组件:

  1. #查询状态
  2. sestatus
  3. #开启selinux
  4. setenforce 1
  5. #关闭selinux
  6. setenforce 0

vim /etc/selinux/config

  1. # vim /etc/selinux/config
  2. # This file controls the state of SELinux on the system.
  3. # SELINUX= can take one of these three values:
  4. # enforcing - SELinux security policy is enforced.
  5. # permissive - SELinux prints warnings instead of enforcing.
  6. # disabled - No SELinux policy is loaded.
  7. SELINUX=enforcing
  8. #SELINUX=disabled
  9. # SELINUXTYPE= can take one of three two values:
  10. # targeted - Targeted processes are protected,
  11. # minimum - Modification of targeted policy. Only selected processes are protected.
  12. # mls - Multi Level Security protection.
  13. SELINUXTYPE=targeted

允许nginx 白名单:

  1. yum install policycoreutils-python
  2. cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M mynginx
  3. semodule -i mynginx.pp

参考:
https://www.jianshu.com/p/491817981a32