Ubuntu localhost: Not found
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).
Related videos on Youtube
Max Krizh
Updated on September 18, 2022Comments
-
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 line127.0.0.1 localhost
.After trying to
sudo service apache2 restart
I have had an error likeCould 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 meIndex of /
and then empty. But when trying to access any subfolder in my/var/www/
, likehttp://localhost/test1
, it gives me a 404.Is there any way of fixing it? Thank you!
-
mtak about 10 yearsAre you sure your Apache's DocumentRoot is set to
/var/www/
? -
Max Krizh about 10 yearsThat's what I have in my config: pastebin.com/ZGFzhZHt
-
Max Krizh about 10 yearsOh. Just changed my
etc/apache2/sites-available
config's document root. Thank you!
-