in Apache

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 *, 1.2.3.4 or example.local

NameVirtualHost *
<VirtualHost *>
</VirtualHost>

You get the gist.