Getting Apache 2 to play nice with Virtual Hosts


If you’re a web developer and you can only get the first Virtual Host to work in your new Apache 2 local setup, it’s very simple to resolve.

Thanks to Alex King for the solution to fix Apache 2 only serving the first virtual host.

Basically the NameVirtualHost must match the value you use in your virtual host declaration, be it *, or example.local

NameVirtualHost *
<VirtualHost *>

You get the gist.