我不确定我的问题是否清楚,但这是一个小的解释:
我正在使用Apache的mod_vhost_alias,这对我来说很容易创build新的域(只需创build相应的域名文件夹)它是这样configuration的:
UseCanonicalName Off VirtualDocumentRoot /var/www/%0/htdocs
但是,我希望能够自动写入日志到/ var / www /%0 / logs
有没有办法用这样的mod来做到这一点?
谢谢
据我所知,你不能这样做的开箱即用。 但是,您可以login到命名pipe道或直接login到脚本,并让脚本根据需要重新创build日志文件:
http://httpd.apache.org/docs/current/logs.html#piped
如果您需要脚本的帮助,请发送日志文件的示例。
用shell脚本编写的非优化的非testing示例:
#!/bin/bash # This assumes the host is mentioned in the first column, replace $1 with the right column if needed. while read line do virtualhost=`echo $line | awk '{print $1}'` echo $line >> /var/www/$virtualhost/log/access_log done