403 forbidden you don’t have permission to access / on this server

Solution for the error 403 Forbidden you don’t have permission to access / on this server. This specific HTTP 403 error will only appear on an Apache server.

First thing to check is the permissions on the specified directory. It needs to be at least 644 or even better 755 which you can set via FTP using your FTP client. Then also check with your hosting provider if Apache mod_security is on and if it could be filtering POST/GET data or the URL itself. If neither of that is the case, continue on…

You can just execute the following command via command line to ensure that the directory is readable by your Apache server.

chmod +x /home/domain/public_html

…where the “/home/domain/public_html” part should be replaced by the specific, absolute path with which you are experiencing the 403 forbidden error mentioned above.

If the permissions on the specified directory is fine and you still experience the problem then it could be because of your Apache DirectoryIndex which is incorrectly configured. The DirectoryIndex of Apache tells the Apache server which file represents the index when a directory is directly access and additionally it can also support multiple indexes in a prioritized list. Here is a very useful article on You don’t have permission to access / on this server.

Open up your terminal and make a connection to your server. I prefer SSH for this.

Locate your httpd.conf file on your server…

locate httpd.conf

It will show you all files with file names containing “httpd.conf” in it. So you can easily find your Apache configuration file. In my case it is /usr/local/apache/conf/httpd.conf. Lets open up the Apache config file…

vi /usr/local/apache/conf/httpd.conf

Find “DirectoryIndex”. It could be empty or it will most likely have the value “index.html”. So if you’re using a PHP application and there is no “index.html” file but rather a “index.php” file that could be the reason why you are getting the 403 forbidden error. Change the DirectoryIndex line to something like this…

DirectoryIndex index.html index.php index.sh default.jsp

You’re all done and you can now restart Apache. Your path to apachectl may differ so just check. You can restart it like this…

/usr/local/apache/bin/apachectl restart

Check now, it should be working just fine! Feel free to comment if you are still stuck. Below are some more links to useful resources on the same topic if you are still stuck…

Comments

  1. By Andy

  2. By Jason

  3. By vincent

  4. By Tobbs

  5. By vinod

  6. By JC

  7. By Ipimin

  8. By Pankaj

  9. By HML

  10. By Ben

  11. By musti

  12. By Ganga

  13. By PhpDev

  14. By Diana Powell

Leave a Reply