Ubuntu localhost: Not found

14,994

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:
14,994

Related videos on Youtube

Max Krizh
Author by

Max Krizh

Updated on September 18, 2022

Comments

  • Max Krizh
    Max Krizh over 1 year

    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!

    • mtak
      mtak about 10 years
      Are you sure your Apache's DocumentRoot is set to /var/www/?
    • Max Krizh
      Max Krizh about 10 years
      That's what I have in my config: pastebin.com/ZGFzhZHt
    • Max Krizh
      Max Krizh about 10 years
      Oh. Just changed my etc/apache2/sites-available config's document root. Thank you!