Changing Apache2 docRoot on Debian 8

If you do not have apache2 install do it before watching video


Please note, that this only applies for Debian 8 and newer releases.
In Debian, the document root was set to /var/www/html.

It was configured in the following file:
/etc/apache2/sites-available/000-default.conf

So just do a:
sudo nano /etc/apache2/sites-available/000-default.conf

and change the following line to what you want:
DocumentRoot /var/www/html the webserver to look for a index file

Also do
sudo nano /etc/apache2/apache2.conf

and find this

<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

and change /var/www/html to your preferred directory
and save and exit.

After you saved your changes, just restart the apache2 webserver and you’ll be done 🙂
sudo service apache2 restart

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.