Ubuntu Apache2 : Change default DocumentRoot /var/www
By default the document root folder for apache2 in Ubuntu is /var/www. This is where you can store your site documents. In order to change the default site location to a different one, /opt/mysite use the following method. A detailed steps to install LAMP on ubuntu is given here. To do this, we must create a new site and then enable it in Apache2. To create a new site: Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example: gksudo gedit /etc/apache2/sites-available/mysite Change the DocumentRoot to point to the new location. For example, /opt/mysite (make sure there is no space in your new folder name; /opt/my\ site/ will not work) Change DocumentRoot /var/www to DocumentRoot /opt/mysite Change th...