When accessed PHP files through a browser, may see "NGINX 403 forbidden error".


Here's the error message from NGINX error log /var/log/nginx/error.log.


[error] 11044#11044: *4 "/home/html/index.php" is forbidden (13: Permission denied)


It is because of the root directory has been changed to the home directory.


Then do the following steps:


Enter the given command:


sudo chmod o+x /home/html


The above command gives others who don't own /home/html and aren't in its group owner achieve permissions on /home/html. It permits the user running NGINX daemon to execute the files on /home/html.


Then restart it.


To restart the Nginx daemon run the following command:


sudo systemctl restart nginx


or


sudo service nginx restart


Then 403 forbidden error will vanish and permitting you to see the actual page.

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)