While constantly doing websites I find myself always needing to work from the root web address. The problem is there is only one localhost. Well we can always create subdomains off of localhost in Ubuntu and Apache very easily(I’m sure other linux distro’s are very similar to do as well) I will walk you through it but there is also another tutorial on ubuntuforums.org.
First we need to add our domain to our hosts in Ubuntu. Todo so go to System -> Administration -> Network. Then click on the Hosts tab. Click the localhost entry and Properties. On a new line add your new aliases(subdomains).
Now on to Apache. We need to open up our httpd.conf file and add an entry for the new virtual host( sudo gedit /etc/apache2/httpd.conf )
Finally we should restart Apache and visit our new domain. Make sure the directory exists where you point your subdomain as well. To restart apache: sudo /etc/init.d/apache2 restart