如何在apache中为每个vhost添加access.log

时间:2013-10-08 19:55:08

标签: apache2 vhosts

这是我目前的vhost:

<VirtualHost *:80>
        UseCanonicalName Off
        VirtualDocumentRoot /var/www/%0/public
        <Directory /var/www/%0/public>
                Options Indexes FollowSymLinks Includes ExecCGI
                DirectoryIndex index.php index.html
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory


</VirtualHost>

如何为每个%0 vhost获取access.log?

仅供参考。如果重要,这是debian安装。

1 个答案:

答案 0 :(得分:1)

您可以在VirtualHost定义中添加TransferLog。更改配置时,请不要忘记重新启动Apache服务。

<VirtualHost *:80>
        UseCanonicalName Off
        VirtualDocumentRoot /var/www/%0/public

        ErrorLog/var/logs/%0/error.log
        TransferLog /var/logs/%0/access.log

        <Directory /var/www/%0/public>
                Options Indexes FollowSymLinks Includes ExecCGI
                DirectoryIndex index.php index.html
                AllowOverride All
                Order allow,deny
                Allow from all
        </Director>
</VirtualHost>