Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have updated my Ubuntu 13.10 to 14.04, so I have a newer version now.

But I spotted that after the update I experience a 404 error while trying to access my http://localhost/

After a complete reinstalling apache and all the related services, it still shows me a 404 error.

By the way, I have added ServerName localhost to httpd.conf, so no result, as well as in my hosts file there is a line 127.0.0.1 localhost.

After trying to sudo service apache2 restart I have had an error like Could not reliably determine the server's fully qualified domain name, using 127.0.1.1., but fixed it successfully.

I am able to access http://localhost/ via the browser, but it shows me Index of / and then empty. But when trying to access any subfolder in my /var/www/, like http://localhost/test1, it gives me a 404.

Is there any way of fixing it? Thank you!

share|improve this question
    
Are you sure your Apache's DocumentRoot is set to /var/www/? – mtak May 7 '14 at 10:26
    
That's what I have in my config: pastebin.com/ZGFzhZHt – Artem Ushakov May 7 '14 at 10:35
    
Oh. Just changed my etc/apache2/sites-available config's document root. Thank you! – Artem Ushakov May 7 '14 at 10:41
up vote 2 down vote accepted

You can take a look at the configuration files at /etc/apache2/sites-available/. By default, there is only one file under the directory named default unless you set up other virtual hosts.

The first line of the file is probably like <VirtualHost *:80>, meaning that this virtual host listen on port 80 of all IPs available (including localhost for your case).

Look into the file for a block of <Directory /var/www/>. This block of code tells Apache to take into account /var/www. If you don't have this block, Apache simply doesn't know to look into /var/www and of course ignoring /var/www/test1, in turn giving you a 404 error. You will need to add in such block accordingly.

You need to give appropriate permission for /var/www/test1 (at least, read permission, plus execute permission as well if you would like others to list folder contents) to apache (user www-data by default).

share|improve this answer

You must log in to answer this question.

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