Change Apache document root (www folder) in Ubuntu

In my development environment I feel comfortable to have my document root directory (www) in my home directory. It gives me much more flexibility for permission issues. To do so Open the /etc/apache2/sites-available/default file with administrative privileged and change the document root as /home/{user}/www, in my perspective it is /home/tapan/www

1. Open /etc/apache2/sites-available/default

sudo gedit /etc/apache2/sites-available/default

2. Change as follows

From,

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

To,

DocumentRoot /home/tapan/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/tapan/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

Bingo!!! Now I dont ever face a big Forbidden in my browser 🙂

(Visited 108 times, 1 visits today)

3 Comments

    1. Tapan Kumer Das December 12, 2013 at 9:49 AM

      What did you face? Did you restart your apache with “sudo service httpd restart” ? (I forgot to mention that 🙁 )

  1. Cesar July 9, 2015 at 6:41 AM

    Thanks! It’s done.

Leave a comment

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