VirtualHost success story

I finally figured out how to get the VirtualHost directives in my Apache configuration to work the way I wanted. I had previously had vhosts defined, but one would always clobber on the other. I suspected something was also in conflict from the server’s default configuration—before the vhosts were defined.

I figured out how to follow the first example in the Apache VirtualHost documentation, and ultimately, that worked. It simply took the addition of a NameVirtualHost line.

I also changed the name of the server at the same time, just to make sure it wouldn’t conflict with the domain. (I didn’t know if that would cause further problems, but having a specific server name was what was outlined in the Apache examples and I’m in no mood to experiment further this morning.) It had previously just been the domain name, but now it’s got a host name (which it always had, I just didn’t have it in the Apache configuration since my last attempt to fix vhosting).

I had also tried changing the DocumentRoot for my vhosts to “/” rather than the absolute path to the site directories. This turned out to be a bad thing: visiting every path in Drupal failed. When I undid that, replacing “/” with the full path to the site folders, it magically started working again.

A big benefit of this is that I can have sub-sites, which can be individually configured and even protected (to only allow access within my network, perhaps). Now, I can use this to do some testing on upgrades and data imports (hello, my old data from Userland Manila!) and other stuff like that.