I was doing my morning reads as usual when I came across an article on creating virtual hosts for apache on OSX. Well after reading the article I decided I’d mention that this pretty much works on Ubuntu as well. Only difference being the location of your config files for the virtual host in apache. Ubuntu generally stores this stuff in /etc/apache2. In there you will find a sites-enabled folder to put your virtual hosts, or, as I have found from being lazy the httpd.conf.

As for editing the hosts file it can be found at /etc/hosts.

Then just restart apache:

sudo apache2ctl restart

A user in the comments on that site also mentioned using a shell script called virtualhost.sh. It appears there is an Ubuntu and an OSX version available which would provide a nice little interface for this process. I’ve not tried it however but appears it would be handy.