[3 Basic Solutions] ‘Apache’s Forbidden Error on your Domain’

Apache is a web server software that is used by almost 67% of all the webservers in the world. This software is developed and distributed by Apache Software Distribution. It is open-source and available for free. Apache is fast, secure and reliable which is one of the reasons for its popularity. However, quite recently a lot of users have been experiencing the “Forbidden – You Don’t Have Permission To Access / on this Server” Error while trying to set up Apache for their domain.

"Forbidden - You don't have permission to access / on this server" Error
“Forbidden – You don’t have permission to access / on this server” Error Fix

What Causes the “Forbidden – You Don’t Have Permission To Access / on this Server” Error?

After receiving numerous reports from multiple users, we decided to investigate the issue and devised a set of solutions to fix it completely. Also, we looked into the reasons due to which it is triggered and listed them as follows.

  • Incorrect Global Directory Settings: It is possible that the settings for the Global Directory haven’t been configured properly which isn’t allowing enough directive to the site. If the site does not have a correct directive it might trigger this error.
  • Incorrect Permissions: Apache requires permissions up to the root folder of the directory in order to function correctly, if these permissions aren’t granted the error might be triggered.
  • No Username: In the “httpd.conf” the actual username of the user has to be entered in some cases to get rid of the error. This works for some people while for some it doesn’t.

Now that you have a basic understanding of the nature of the problem, we will move on towards the solutions. Make sure to implement these in the specific order in which they are presented.

Solution 1: Changing Global Directory Settings

Certain Settings need to be configured properly in order to fix this issue. Therefore, in this step, we will be adding the Options Directive in the Global Directory Settings which is located in the “httpd.conf” or the “httpdvhosts.conf” depending upon the user. For that:

  1. Once you are in the “httpd.conf” or the “httpd-vhosts.conf”, look for the directory settings, they should be similar to the below-mentioned code.
    <Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
    </Directory>
    “httpd.conf” file

    Note: It is possible that the code has “Deny From All” in place of “Allow From All“. It is important that you modify it to “Allow From All” or “Require All Granted” as indicated below.

  2. Make sure you add the “Options Indexes FollowSymLinks Includes ExecCGI” line to it in such a way that it looks similar to the following code.
    <Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
    </Directory>
  3. Check to see if the issue persists.
  4. If the problem isn’t solved modify the code by removing “Allow from All” to “Require All Granted“.
  5. Check to see if the issue persists

Solution 2: Changing Permissions

When the user is linking Apache to their domain they provide permissions to the software to be able to read and write the files. It is important that these permissions are provided properly. Below we will indicate the proper way of providing permissions.

  1. Conventionally, users provide permissions in the following way.
    chgrp -R www-data /username/home/Dropbox/myamazingsite/
    chmod -R 2750 /username/home/Dropbox/myamazingsite/
  2. These commands are wrong and need to be replaced with
    chgrp -R www-data /username
    chmod -R 2750 /username
  3. Also, keep in mind that you are using the correct level of “chmod“, use one that provides read permissions to users such as the “chmod 755“.
  4. Check to see if the issue persists after trying the suggestions.

Solution 3: Adding Username

In the “httpd.conf“, make sure to add your exact username instead of the words “User” or “Group”. In some cases, adding the user name fixes the issue.

Add User name to the indicated File
ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.