Apache - 使用VirtualHosts的动态ErrorLog和CustomLog

时间:2014-03-05 19:52:22

标签: apache virtualhost httpd.conf error-log

我的动态VirtualHosts在CentOS 6.5和httpd 2.2.15上运行良好。 我可以访问我的网站http://foo.dev.comhttp://bar.dev.com。 问题是我没有动态的CustomLog和ErrorLog。

/etc/httpd/conf.d/dev.com.conf:

UseCanonicalName Off

NameVirtualHost *

<VirtualHost *>
    VirtualDocumentRoot "/home/username/PHP/%0/public_html/"
    <Directory "/home/username/PHP/%0/public_html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order Deny,Allow
        Allow from all
    </Directory>
</VirtualHost>

目录结构:

/home
    /username
        /PHP
            /foo.dev.com
                /public_html
                /logs
            /bar.dev.com
                /public_html
                /logs

我试过了:

    ...

    CustomLog "/home/username/PHP/%{HTTP_HOST}/logs/access_log" combined
    ErrorLog "/home/username/PHP/%{HTTP_HOST}/logs/error_log"
</VirtualHost>

并收到以下错误:

(2)No such file or directory: httpd: could not open error log file /home/username/PHP/%{HTTP_HOST}/logs/error_log
Unable to open logs

还有:

    ...

    CustomLog "/home/username/PHP/%0/logs/access_log" combined
    ErrorLog "/home/username/PHP/%0/logs/error_log"
</VirtualHost>

出现以下错误:

(2)No such file or directory: httpd: could not open error log file /home/username/PHP/%0/logs/error_log.
Unable to open logs

有可能吗?

0 个答案:

没有答案