views:

44

answers:

2

I'm running Ubuntu. My Apache2 default file looks like this:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                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 Indexes 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 this file called Index.php in /var/www/

<?
phpinfo();
?>

When I access http://localhost/ in my browser, I'm getting the 404 Not Found error:

The requested URL / was not found on this server. Apache/2.2.16 (Ubuntu) Server at localhost Port 80

What am I doing wrong? This actually worked when I first setup LAMP but it's not working now.

A: 

Do you have the PHP module installed and enabled? Because, normally, it would mention that in the server signature, but yours doesn't. That would also explain why the server doesn't recognize that "index.php" is what you mean by "/".

Try "sudo a2enmod php5"

hatkirby
Module php5 already enabled
slandau
A: 

Have a look in /etc/apache2/sites-enabled. It seems like my upgrade to 10.10 has wiped the symlinks from that directory. Try symlinking default to /etc/apache2/sites-available/default

sudo ln -s /etc/apache2/sites-available/default /etc/apache2/sites-enabled/default
Andreas Jansson
Tried that and still nothing...
slandau
and you restarted apache as well?
Andreas Jansson
Okay, after I restarted Apache2 I get to the 'Index of /' page, where I can see the directory. How do I get it to once again default to the Index.php page in that directory like it used to?
slandau
easiest way, just rename Index.php to index.php
Andreas Jansson
or, you can edit /etc/apache2/mods-enabled/dir.conf, adding Index.php to DirectoryIndex
Andreas Jansson
Thank you! Awesome job following up.
slandau