I recently installed Ubuntu 14.04, then I installed lamp-server
and placed my webpages in /var/www
directory, but when I opened localhost in the browser there was nothing.
I think that happened because Zend updated Apache.
Whatever the reason may be, I want to know where to keep my php files so that I can access them from my browser.
The apache2 version that was published when the Ubuntu 14.04 release was made is 2.4.7 and starting with this version it seems that, for security reasons, the new root directory for the server is:
So, from now on, this is where you must place the files for your (local) website. You should not have this problem again with the future updates.
Anyway, if you want to change this directory with another one, you have to modify (as root) the following line from
/etc/apache2/sites-available/000-default.conf
file (sudo nano /etc/apache2/sites-available/000-default.conf
):to
After this, for the new changes to take effect, you have to restart the apache server using the following command:
Instead of modifying
/etc/apache2/sites-available/000-default.conf
back to the old version, I prefer keeping default package files unmodified.A reason for this is that so it wouldn't break during the next upgrade again which might reset the
000-default.conf
file.Besides, such modifications are not done just to annoy us, the modification was done for a good reason, as this bug report in Debian explains.
A better solution would be to move the sites files from
/var/www
to/var/www/html/
.Also, another possible solution is to create another Virtual Host and disable the default one with the command
sudo a2dissite 000-default