Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I currently use mod_vhost_dbd to pull a path from MySQL and insert as a docroot for Apache. This allows me to dynamically change customers from a production to a beta copy of our app with a simple db record update. It also greatly reduces our virtual host configuration, since a single vhost block can accommodate all of our subdomains (www. may return /var/www/prod while test. can return /var/www/test, for example).

The problem occurs if there's any disruption in db connectivity. If it doesn't find a valid entry for the subdomain, it fails back to the defined docroot within the virtualhost config. With the current mod_vhost_dbd, the server will throw a 500 error if it can't reach the db server for any reason.

So my question is - has anyone implemented this sort of dynamic docroot setup with another mechanism? Is there a modification we can make to the current mod_vhost_dbd to make it fail to the default virtualhost docroot on not only a missing record, but also a loss of db connectivity?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.