mod_deflate日志记录

时间:2013-01-06 04:40:59

标签: apache logging

我在Apache2.2设置的Includes目录中有以下内容,但它没有记录

    AddOutputFilterByType DEFLATE text/html text/plain php application/x-httpd-php application/json
    #Highest 9 - Lowest 1                                                                
    DeflateCompressionLevel 9

   #Optional
   #Skip browsers with known problems
   BrowserMatch ^Mozilla/4 gzip-only-text/html
   BrowserMatch ^Mozilla/4\.0[678] no-gzip
   BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

   #Optional
   #Logging
   DeflateFilterNote ratio
   LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
   CustomLog /usr/vhosts/example.com/logs/deflate_log deflate

然而,我没有记录。日志文件的权限是root:wheel -rw-r - r--

想法?

1 个答案:

答案 0 :(得分:0)

这里有一个猜测,但你提到了Apache包含哪些东西让你有一个单独的文件为你的站点或多个vhosts减速,因此确保你指定使用哪个logformat,例如:

<VirtualHost *:443>
...

ServerAdmin support@danols.com
ServerName webdesign.danols.com
ServerAlias www.webdesign.danols.com new.webdesign.danols.com

#LogLevel info
ErrorLog ${APACHE_LOG_DIR}/webdesign.danols.com-errors.log
CustomLog ${APACHE_LOG_DIR}/webdesign.danols.com-vhost_combined_deflate-access.log vhost_combined_deflate

...
    </VirtualHost>

然后使用 - http://www.whatsmyip.org/http-compression-test/验证网站是否实际被压缩,现在您的日志应该显示如下(请注意请求结束时的压缩统计信息):

webdesign.danols.com:443 72.38.184.18 - - [28/Mar/2013:09:52:19 -0400] "GET /static/template/images/icons/dark/ohloh-w32-h32.png HTTP/1.1" 200 3076 "https://webdesign.danols.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31" "2595/2867 (90%)"
webdesign.danols.com:443 72.38.184.18 - - [28/Mar/2013:09:52:19 -0400] "GET /static/template/images/icons/dark/designquote-w32-h32.png HTTP/1.1" 200 2564 "https://webdesign.danols.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31" "2079/2360 (88%)"
webdesign.danols.com:443 72.38.184.18 - - [28/Mar/2013:09:52:19 -0400] "GET /static/template/images/bg_direction_nav.png HTTP/1.1" 200 2612 "https://webdesign.danols.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31" "2137/2427 (88%)"
webdesign.danols.com:443 72.38.184.18 - - [28/Mar/2013:09:52:19 -0400] "GET /static/template/images/icons/dark/designgigs-w32-h32.png HTTP/1.1" 200 2372 "https://webdesign.danols.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31" "1887/2171 (86%)"