Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hey guys I'm having a really weird issue here with my AWS EC2 instance. I have set up my LAMP stack with PHP5.5 MariaDB and Apache2, I have created/enabled my conf file (below)

<VirtualHost *:80>

    ServerName localhost
    DocumentRoot /var/www

    SetEnv  APPLICATION_ENV live

    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews

        DirectoryIndex index.html index.php

        Order allow,deny
        AllowOverride All
        Allow from All
    </Directory>

    <IfModule mod_rewrite>
        RewriteEngine On
    </IfModule>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

and have even tried dropping an htaccess with a DirectoryIndex in my webroot. None of this though seems to be respecting my DirectoryIndex? Any ideas? mod_dir is enabled, as well as mod_rewrite, you think between the two Apache would be able to figure it out??

You can use http://54.200.197.102/ to check it out, security groups are set to allow on 80, and you can see my directory structure here for var dub

-rw-r--r--  1 ubuntu ubuntu   4566 Jan 30 18:58 backup
-rw-rw-r--  1 ubuntu ubuntu     50 Jan 30 19:10 .htaccess
-rw-rw-r--  1 ubuntu ubuntu     12 Jan 30 19:09 index.html
-rw-rw-r--  1 ubuntu ubuntu      4 Jan 30 18:51 index.php

contents of htaccess are below

DirectoryIndex index.php index.html

I'm seriously at a loss atm?

share|improve this question
    
That's weird I'm getting the default apache2 It Works! even after flushing my cache etc? –  ehime Jan 30 at 19:34

2 Answers 2

up vote 2 down vote accepted

It says: "Works: index.php".

Did you clear your browser cache?

share|improve this answer
    
I did, very weird... Accepted. Works in Chrome, FF is being a bugger, maybe its holding onto its cache even after a hard flush..? –  ehime Jan 30 at 19:35
    
Did you omit some important detail from your question? –  Michael Hampton Jan 30 at 19:35
    
I didn't, but I believe you're correct about the caching, I think FF won't release its cache for whatever reason. +1 and waiting to accept. –  ehime Jan 30 at 19:36
2  
Try quitting and restarting it. The last couple of releases of FF have been a little buggy. –  Michael Hampton Jan 30 at 19:38
    
That's what I did followed by a ctrl+f after a hard flush, seems to have resolved.... silly FF... –  ehime Jan 30 at 19:41

Apache will resolve through the DirectoryIndex config variable until it finds a match, it stops processing on the first match it finds in the directory you are browsing to (in your case the document root: /var/www)

in your config you specified the order index.html index.php, this means as soon as it sees index.html in the directory it will serve it, if not it will look for index.php and serve it if it finds it

if it doesn't find either document, then it will default to your Directory Indexes permission for the directory or the closest match which in your case is an allow so it would show directory contents

you have overridden the VHOST DirectoryIndex config in your .htaccess (which is not unusual) so that it searches for index.php then index.html - which is the behaviour you are currently seeing as index.php is the first match (even though both files exist)

basically pick your preferred file and rename the other to something else or delete it and/or reconfigure your VHOST/.htaccess file so specify the exact one you prefer (guessing index.php)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.