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

Tue, Apr 27, 2010

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. Alternatively, 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…

, , , , , , , , , ,
lightbox-js-widejpg

This post was written by:

- who has written 71 posts on 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.

Contact the author

13 Comments For This Post

  1. Andy Says:

    Hi Antonie,

    I have directory listing disabled on my CakePhp server by using “Options -Indexes” in the conf file. On trying to open a directory, say, http://mysite.com/img/, I get the following error (403) from Apache

    Forbidden
    You don’t have permission to access /app/webroot/img/ on this server.

    The problem is that this 403 error displayed the virtual path in the output (/app/webroot/img/). Is there any way of disabling this path in the output?

    Thanks!

  2. Maher Saif Says:

    Thanks Antonie.

    @Andy, you can put empty index.html file in that location(/app/webroot/img/), and nothing will appear.

  3. Jason Says:

    Hi, I just installed CodeIgniter in /var/www/html, ensured sufficient permissions and httpd.conf setup. I still get the 403 error when accessing it via the web. This is odd because I’ve been writing PHP code, storing it in this directory and subdirectories off of it, and accessing it via the web for a while. Seems like there’s a problem when I don’t literally “md” the directory. It shouldn’t make a difference, but I chowned the directory to be the same as the others. Still no dice. Any ideas? Thanks!

    Jason

  4. vincent Says:

    i just finished installing and configuring a coldfusion application on my server.right now i cannot access the application from other work stations.

    each time i try to access the application the response will be:’ Forbidden you don’t have permission to access / on this server.

    what can i do to solve this problem?

    i will be most greatfull if youn can help me solve this.

    kind regards

    vincent

  5. Tobbs Says:

    Permissions 755! Noticed this is true for the entire path! Thanks!

  6. vinod Says:

    Hi, I just installed CodeIgniter in /var/www/html, ensured sufficient permissions and httpd.conf setup. I still get the 403 error when accessing it via the web. This is odd because I’ve been writing PHP code, storing it in this directory and subdirectories off of it, and accessing it via the web for a while. Seems like there’s a problem when I don’t literally “md” the directory. It shouldn’t make a difference, but I chowned the directory to be the same as the others. Still no dice. Any ideas? Thanks!

  7. JC Says:

    Hi there.. I’m going through the same issue I tried chmoding to 755 all the directories I checked one by one…
    I have:
    /var/www/html/websites/mypage1 and all the subdirectories like image, scripts, etc.. are 755

    Which I just don’t understand is why if the configuration file is set up to show the content in listing mode (before changing permission to 755) allows me to see all the content; why if I turn off indexing I get the 403 forbidden message…

    Pleas give me a hint… first time I tried Apache was in Windows 7 (laptop) and it worked like a charm the test website I created was live for a couple of days so I decided to get my old desktop and turn it into Fedora 14 web server… now the site is forbidden. any other ideas???

  8. Ipimin Says:

    I’m trying to access this domain: http://colegioetapa.com.br/wrdb/uploads/. but when I come to appear: Forbidden

    You do not have permission to access / wrdb / uploads / on this server.

    Apache/2.2.3 (CentOS) Server at Port 80 colegioetapa.com.br
    would solve?
    sorry a mistake, I’m from Brazil and used the Google translator …
    Thanks in advance!

  9. Pankaj Says:

    Amazon EC2 Cloud Installation.
    setup instance, elastic IP configuration, cloud instant accessing from local computer using Putty and FTP connection.

    http://onlinewebapplication.com/2011/09/amazon-ec2-cloud-installation-setup.html

  10. HML Says:

    Hi, Thx a lot !

  11. Ben Says:

    Just to add some trick as newbie.

    If you still get the 403 Forbidden error, try to remove the .htaccess file (off course you have to back it up first.

    go to the folder where you cannot access

    # cd /destination_folder

    backup .htaccess file then remove it

    # cp .htaccess .htaccess.BAK
    # rm -f .htaccess

    then re-set the permission

    # chmod -R 755 destination_folder

    Hope this help… cheers

  12. musti Says:

    Hi, I ‘ve just come accross this useful post that deals with the 403 error. The solutions provided here seem logical and effective, but I could not really find a solution to my current problem. I have a website built upon WordPress 3.2.1 Everything works fine, I can add new posts and pages, modify them and delete them successfully , but the problem I have is when I try to update my custom menu I always get the following error:

    Forbidden
    You don’t have permission to access /wp-admin/nav-menus.php on this server.

    I tried many solutions but in vain. I tried to delete the .htaccess file, remove the plugins and even do a fresh wordpress install and still I could not find out what is the problem.

    I would be so thankful to anyone who could help me out with this issue.

  13. bismillah Says:

    hello i want to download yahoo there is coming error forbidden how i can solf this problems

Leave a Reply