Tapan's World

Tapan Kumer Das

Darus Sallam, Mirpur, Dhaka, Bangladesh
Tapan Kumer Das

Change Apache document root (www folder) in Ubuntu

July 28, 2012, by tapan, category LAMP, Linux, 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 🙂

3 Comments

So, what do you think ?