开发者

Configure apache mod-vhost-alias

开发者 https://www.devze.com 2022-12-24 23:59 出处:网络
开发者_开发技巧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 dir
开发者_开发技巧

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

0

精彩评论

暂无评论...
验证码 换一张
取 消