Nginx 403 Forbidden was finally solved, nginxforbidden
Nginx 403 Forbidden Solution
Step 1:
Check directory permissions. Add a permission if the permission is insufficient.
Example: chmod-R 755/var/www
Step 2:
Open nginx. conf
Example: vim/etc/nginx. conf
Change the user name to user root or other user names with high permissions.
Step 3
For centos, check if selinux is disabled.
View SELinux status:
1./usr/sbin/sestatus-v # If The SELinux status parameter is enabled, it is enabled.
SELinux status: enabled
2. getenforce # You can also use this command to check
Disable SELinux:
1. temporarily shut down (no need to restart the machine ):
Setenforce 0 # Set SELinux to permissive Mode
# Setenforce 1 Set SELinux to enforcing Mode
2. to modify the configuration file, restart the machine:
Modify the/etc/selinux/config file
Change SELINUX = enforcing to SELINUX = disabled
Restart the machine.