0

我在 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--

想法?

4

1 回答 1

0

这里有一个猜测,但您提到 Apache 包含这让我觉得您的站点有单独的文件或多个虚拟主机减速,因此请确保您指定要使用的日志格式,例如:

<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%)"
于 2013-03-28T13:59:07.973 回答