nginx用yum安装完毕后启动不了,显示为 failed (13: Permission denied)

关于selinux模式的文章:传送门

命令行临时关闭selinux确认是否由此设置引起的

getenforce    #查看selinux状态
setenforce 0

然后测试是否可以访问如果可以则证明是selinux的问题,于是先关掉selinux

1.添加nginx到selinux的允许列表(推荐

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

2.修改配置文件关闭selinux(需要重启机器)

修改/etc/selinux/config 文件


# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

重启电脑查看 Selinux 状态,应该为关闭状态

$ getenforce 
Disabled
Last modification:January 30, 2020
如果觉得我的文章对你有用,请随意赞赏