Common, causes the Nginx 403 forbidden to have two kinds of reasons, first is the missing index file, two permissions question.
1, missing index.html or index.php files
Copy Code code as follows:
server {
Listen 80;
server_name localhost;
Index index.php index.html;
root/var/www;
}
If there is no index.php,index.html under the/var/www, direct access to the domain name, can not find the file, will be reported 403 forbidden.
For example: You access www.test.com and this domain name, corresponding to the root specified by the index file does not exist.
2, Permission issues
For PHP, this error can result if the Nginx user does not have permission to the Web directory.
Workaround: Modify the Web directory's read and write permissions, or change the Nginx user to the directory of the user, a restart can be resolved. Such as:
Copy Code code as follows:
Chown-r Nginx_user:nginx_user/htdocs
"Note": Do not forget to restart the Nginx service after modifying the configuration