403 Forbidden you dont have permission to access on this server

Home > Search

When attempting to access a web page from an Apache, httpd, or nginx web server, if message 403 Forbidden you don't have permission to access on this server appears, first check the permissions on the directory and files.


As an example, let's say you are getting this error when requesting the index.html file, which is located at /var/www/html/index.html.  The first thing to check is to see if the /var/www/html directory and the index.html file have the read permission. Use the ls -l command to view the permissions. If you are not controlling permissions through access control lists (ACLs), the minimal permission needed to view the index.html file is 555 or r-xr-xr-x (read and execute).

ls -l /var/www
ls -l /var/www/html


After modifying the permissions, if 403 Forbidden you don't have permission to access on this server still appears, there could be an issue with SELinux. Use the ls -lZ command to view the SELinux permissions on the index.html file.

ls -Z /var/www/html


In this example, the permissions are unconfinded_u:object_r:admin_home_t:s0.  Notice the type is admin_home_t.  Apache needs the type to be httpd_sys_content_t.


Use the following command to update all of the directories and files used by Apache to be httpd_sys_content_t.

restorecon -Rv /var/www/html


If we run the ls -lZ /var/www/html command again, we should see that index.html now has type httpd_sys_content_t.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.