How to change apache default document root

In todays “How to …” section I want to share my findings about how to change the www doc root in your apache web server.

  • Let’s assume you want to change from /var/www/html to /var/wp4
  • All you have to do is to change DocumentRoot in /etc/apache2/sites-enabled/000-default.conf to
    DocumentRoot /var/www/wp4 
  • All files in /etc/apache2/sites-enabled should be symlinks to files in /etc/apache2/sites-available
    # ls -l /etc/apache2/sites-enabled/
    lrwxrwxrwx 1 root root ... 000-default.conf -> ../sites-available/000-default.conf

  • Please never ever change /etc/apache2/apache2.conf!!!

As always – have Fun!
Cheers
Ubuntix

Leave a Reply

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