nginx 403 Forbidden

问题来源一

目录权限设置不对

问题来源二

目录树下缺少index.php, index.html等

问题来源三

SELINUX没有关闭,这个晚上碰到真心是个坑啊
判断SELINUX是否开启

getenforce

临时关闭SELINUX,修改selinux配置文件
修改前:

# 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=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

修改后:

# 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

巨人的肩膀

Resolving “403 Forbidden” error
Nginx 403 forbidden for all files