Apache conf

时间:2016-03-08 18:34:01

标签: apache virtualhost

我目前将Web服务器设置为开发环境并设置DNS,以便基本上任何子域都有效,即* .mydomain.com。我在Apache配置中使用以下VirtualHost部分实现了这一点,其中/ var / www / html /%1是子域的文档根目录:

<VirtualHost x.x.x.x:80>
    ...
    ServerName %1.mydomain.com
    DocumentRoot /var/www/html
    VirtualDocumentRoot "/var/www/html/%1"
    LogFormat "%V %h %l %u %t \"%t\" %s %b" vcommon
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined
</VirtualHost>

但是,我尝试使用以下命令将ErrorLog和CustomLog写入更相关的目录中的文件:

    ErrorLog "/var/www/html/%1/error.log"
    CustomLog "/var/www/html/%1/access.log" combined

这打破了事情。 Apache不会开始并报告:

No such file or directory: [client AH02291: Cannot access directory '/var/www/html/%1/' for error log[...]

在我看来,ErrorLog和CustomLog选项并没有像VirtualDocumentRoot一样扩展/评估%1,所以我的问题是,如此简洁,我该如何做到呢?

提前致谢。

0 个答案:

没有答案