I'm trying to migrate my virtualhosts to a mysql database using vhost_dbd_module.
In the various examples I find online, they instruct me to use "ServerName *" as a wildcard in the VirtualHost.
When I configure my VirtualHost this way, the server just defaults back to the default DocumentRoot. It does not query the mysql database.
<VirtualHost *:80>
# catch all other requests that don't get caught above
ServerName *
# fallbackDocumentRoot in case mysql server is down
DocumentRoot /var/html/404
DBDriver mysql
DBDParams "host=<hostname> user=<user> dbname=<dbname>"
DBDocRoot "SELECT documentRoot FROM virtualhosts WHERE serverName = %s" HOSTNAME
</VirtualHost>
However, when I change it to this (specify the ServerName to domain.tld), it works properly (queries the database for domain.tld and returns the proper documentroot for domain.tld)
<VirtualHost *:80>
# catch all other requests that don't get caught above
ServerName domain.tld
# fallbackDocumentRoot in case mysql server is down
DocumentRoot /var/html/404
DBDriver mysql
DBDParams "host=<hostname> user=<user> dbname=<dbname>"
DBDocRoot "SELECT documentRoot FROM virtualhosts WHERE serverName = %s" HOSTNAME
</VirtualHost>
Any ideas what is misconfigured?