I am typing out and following along with Week 9 codes as shown in lecture. When i remove index.html and index.php from my directory, i expect to see list of files when i run http:// localhost in google chrome. Instead I get this error -


You don't have permission to access / on this server. 

See 43:08 of Week 9

  • Did you change the permissions for the file you're trying to access using chmod?
    – kzidane
    Commented Jul 9, 2014 at 19:09
  • Not trying to access 1 file. Want to see the listing. i61.tinypic.com/nlpmpj.png Commented Jul 9, 2014 at 19:38

3 Answers 3


This is apache preventing you from allowing visitors to see the list of files. You need to do one of two things, the easiest just being to change your Options line for the site. Look in your configuration file that could be in

  1. /etc/httpd/conf/httpd.conf
  2. /etc/apache2/sites-enabled/000-default.conf

these are just two popular options. Look inside for a <Directory "/var/www/html"> (or whatever your document directory is) for and Options line. You need to have Indexes on that line. You will also need a line Require all granted (I don't recall the older syntax, but hopefully you're running Apache 2.4.x.

Hope that helps.


Try to create a folder named "public" on localhost, and copy your whole project inside it.

  • I am able to run a project from inside a folder. However what i want is to be able to see the list of directories, like in the picture I posted. Commented Jul 11, 2014 at 5:58
  • Remotely listing files of a webserver is often considered a security issue if you are not hosting a FTP server. The behavior you want is prevented in secured environments for the same reason, unless you explicitly specify that you want people looking at your public source files.
    – Cygni_61
    Commented Jul 11, 2014 at 8:10

In order to be able to list directories, you have to change the permissions of the folder named public inside your ~/vhosts/localhost/ to be 755. To do that execute these commands

sudo chmod 755 ~/vhosts/localhost/public/

If prompted for a password, enter "crimson". Also, there must be no index.html or index.php files in that directory, because if there's any of these (or both), it'll be displayed by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .