Friday, March 14, 2014

Ubuntu: Change default location of localhost

localhost
By default, localhost (127.0.0.1) points to /var/www/ directory in Ubuntu. I prefer the location to be in my home directory.
To change the default location, open the file:
/etc/apache2/sites-available/000-default.conf
 and change it to look as follows:
(My wokspace is located at /home/chaithanya/www)

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/chaithanya/www

        <Directory /home/chaithanya/www/>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/access.log common
</VirtualHost> 
Note: This works for Ubuntu 13.10+