2

I have got Ubuntu 12.04. I have a file index.html in apache'd document root but apache lists all the files when I access the document root from the browser.

It works fine if I replace index.html by index.php.

My /etc/apache2/sites-enabled/000-default:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

DocumentRoot /home/test/www
<Directory /home/test/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>



    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options   MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

I have /etc/apache2/mods-enabled/dir.conf:

<IfModule mod_dir.c>

          DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

</IfModule>

I did lot of searching but don't know my why index.html is not working and is getting listed in the browser.

If I keep both the files (index.html and index.php), then index.php works fine.

Here is the output of ls -l /home/test/www:

total 1816236
-rw-r--r--  1 root   www-data          3 Jun  3 10:09 index.html
-rw-r--r--  1 ubuntu www-data         53 Mar  4 16:55 index.php
drwxrwsr-x  5 ubuntu www-data       4096 May 12 05:03 lifetimeholidays
-rw-r--r--  1 root   www-data 1859796992 May 29 10:32 magentolive17_4_2014.zip
drwxrwsr-x 15 ubuntu www-data       4096 May 28 15:22 railsapp
drwxr-sr-x 15 root   www-data       4096 May 28 17:15 railsapp1
drwxrwxr-x  2 ubuntu www-data       4096 Apr 29 09:05 var
5
  • Can you paste the output of ls -l /home/test/www Commented Jun 3, 2014 at 10:56
  • I have updated my question that now shows the output of the above command. Commented Jun 3, 2014 at 11:00
  • Thanks Christopher. It solved my problem. I had an .htaccess file which was overriding my apache configurations. Commented Jun 3, 2014 at 11:14
  • But index.php is not getting opened by default now if I keep only index.php. Commented Jun 3, 2014 at 11:28
  • I finally changed AllowOverride All to AllowOverride None to get everything working. Commented Jun 3, 2014 at 11:37

1 Answer 1

1

Do you have a .htaccess file in /home/test/www/? The AllowOverride All stanza would allow the reading of that file, which is an Apache dynamic configuration file for that directory. It's contents override the configuration directives in /etc/apache2/sites-enabled/000-default.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.