I was wondering if you could use a wildcard in the VirtualDocumentRoot directive. I mean is it possible to scan multiple directories with the VirtualDocumentRoot, like multiple home directories to look for sites?
Use of wildcards in the VirtualDocumentRoot
directive is not possible using Apache 2.2.3.
A correct VirtualHost entry for HTTP requests looks like this:
<IfModule mod_vhost_alias.c>
<VirtualHost *:80>
ServerAlias *
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/log/httpd/access_log vcommon
VirtualDocumentRoot /var/www/vhosts/shared/%0
VirtualScriptAlias /var/www/vhosts/shared/%0
</VirtualHost>
</IfModule>
This will serve a request to subdir.mydomain.com
from the directory /var/www/vhosts/shared/subdir.mydomain.com
To serve HTTPS requests too, duplicate this and replace *:80
with *:81
精彩评论