Jumat, 23 Mei 2014

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

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

Posted in Server By Antonie Potgieter On April 27, 2010

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 onYou 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…

About Author

lost-in-code

I (Antonie Potgieter) am a software engineer/web developer located in South Africa. My full-time work is the management of Tribulant Software and the development of its software packages.

Tidak ada komentar:

Posting Komentar