Common Causes of nginx 403 forbidden are: Missing index files and permissions.
1. Missing index.html or index. php files
Server {listen 80; server_name localhost; index. php index.html; root/var/www ;}
If no index.php or index.html is available under/var/www, the system will report 403 forbidden if the domain name is directly accessed and the file cannot be found.
For example, the index file specified by root does not exist when you access www.test.com.
2. Permission issues
Server {listen 80; server_name localhost; index. php index.html; root/var/www ;}
In this case, the current user does not have the permission to read the directory, so the 403 error will be reported.
Solution: Modify the read and write permissions of the web directory, or change the start user of nginx to the user of the directory.
[Note]: Do not forget to restart the nginx service after the configuration is modified.