Easier vHost setup

2013/09/10

Starting development on a new web project is a pretty mundane task: Probably cloning some existent repository or creating the initial folder structure and then setting up a local virtual host, so each project got it’s own development domain, like fancyproject.dev.

Especially the last part is quite annoying: Manually editing the hosts-file and adding a new vHost in the Apache config files.

After years of just going with this workflow, I found a way to cut this whole process. Using dnsmasq and wildcards in the Apache config do the same thing without having to change a single line of config files.

dnsmasq

dnsmasq is a little DNS server and I only use it to route all request targeted at *.dev to the local machine and thereby make editing the /etc/hosts file redundant.

For installing it on a Mac I suggest using Homebrew, following these steps (mostly in the terminal of your choice):