Apache web server is one of the most popular and widely used opensource web servers , especially in the web hosting platforms.
Be that as it may, you may get a “Forbidden – You don’t have permission to access / on this server” error on your browser after setting up your website. It’s quite a common error and users have experienced it while testing their site. So what it this error?
It is also referred to as 403 Forbidden error, Apache’s ‘Forbidden Error’ is an error that is displayed on a web page when you are attempting to access a website that’s restricted or forbidden.
Additionally, the error can shown in several ways on the browser as indicated below:
- HTTP Error 403 – Forbidden
- Forbidden: You don’t have permission to access [directory] on this server
- 403 Forbidden
- Access Denied You don’t have permission to access
- 403 forbidden request forbidden by administrative rules
The ‘403 Forbidden Error‘ occurs due to the following main reasons:
1. Incorrect File / Directory Permissions
This error can be triggered due to incorrect file/folder permissions on the webroot directory. If the default file permissions are not adjusted to grant users access to the website files, then chances of this error popping on a web browser are high.
2. Misconfiguration of the Apache Configuration Files
This error can also be attributed to a misconfiguration of one of the Apache configuration files. It could be an incorrect parameter that has been included or missing directives in the configuration file.
Fixing the ‘403 Forbidden Error’
If you have encountered this error, here are a few steps that you can take to remedy this.
1. Adjust file permissions & ownership of the webroot directory
Incorrect file permissions & directory ownership are known to restrict access to website files. So, firstly, be sure to assign the file permissions recursively to the webroot directory as shown. The webroot directory should always have EXECUTE permissions and the
index.html file should have READ permissions.
$ sudo chmod -R 775 /path/to/webroot/directory
Additionally, adjust the directory ownership as shown:
$ sudo chown -R user:group /path/to/webroot/directory
Where the user is the regular logged-in user and the group is
The finally, reload or restart the Apache webserver for the changes to take effect.
$ sudo systemctl restart apache2
If this does not resolve the issue, proceed to the next step:
2. Adjust directives in Apache main configuration file
In Apache’s main configuration file
/etc/apache2/apache2.conf, ensure that you have this block of code:
<Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> <Directory /usr/share> AllowOverride None Require all granted </Directory> <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
Save and exit and thereafter, restart the Apache.
If you are running Apache on RHEL / CentOS systems, ensure that you relax access to the
/var/www directory in the
/etc/httpd/conf/httpd.conf main Apache configuration file.
<Directory "/var/www"> AllowOverride None Require all granted </Directory>
Then save all the changes and reload Apache.
$ sudo systemctl restart apache2 Thank you for reading this article.
Was this helpful?
1 / 0