Recent ramblings... on Apache

 
 
 

Setting up subdomains in virtual hosts on your local machine

I recently built a ‘software as a service’ web application which allowed clients to signup and create webpages online and setup unique short url links to direct and track traffic. Each client had a subdomain off of the main domain which routed traffic to the correct webpage, we also recorded information about the visitor and displayed real-time statistics within an admin area accessible via a directory off of the clients subdomain.

One of the issues I hit early on in this project was how to build this on my local machine, my setup used an Apache server on my Mac with a port based directory (such as http://127.0.0.1:9000) which would not play nicely with subdomains. Luckily with the beauty and simplicity of the Apache server I was able to setup development domains locally and create a wildcard virtual host to catch all my subdomains.