All posts All posts by this author Paper color Change page color Announcements

Adding Subdomain to localhost in Ubuntu-12.04 : Apache

Considering you have apache installed.

~$ sudo vi /etc/apache2/sites-available/mysite

Add the following configuration to the file

<VirtualHost *:80>
    DocumentRoot /path_to/mysite
    ServerName mysite.localhost
    <Directory /path_to/mysite>
        Options Indexes FollowSymLinks MultiViews +Includes
        AllowOverride all
        Order allow,deny
        allow from all

Enable the subdomain

~$ sudo a2ensite mysite

Restart Apache

~$ sudo service apache2 restart

Edit hosts file

~$ sudo vi /etc/hosts

Add the following line mysite.localhost

Thats all.

Software Solutions