gzip的COM pression code htaccess的不工作工作、COM、gzip、pression

2023-09-02 11:43:35 作者:傻子真可爱,

我想COM preSS使用gzip COM pression并为此目的,我使用下面的code。在我的.htaccess文件我的网页内容,但它不能正常工作

 #BEGIN的COM preSS文本文件
< ifModule mod_gzip.c>
  mod_gzip_on是
  mod_gzip_dechunk是
  mod_gzip_item_include文件。(HTML |?TXT | CSS | JS | PHP | PL)$
  mod_gzip_item_include处理^ CGI脚本$
  mod_gzip_item_include MIME ^文本/.*
  mod_gzip_item_include哑剧^应用程序/ x-j​​avascript的。*
  mod_gzip_item_exclude MIME ^图像/.*
  mod_gzip_item_exclude rspheader ^内容编码:*。* GZIP
< / ifModule>
#END的COM preSS文本文件
 

我使用此工具测试GZIP COM pression ,但是这个工具告诉,没有GZIP COM pression在我的网页。

有没有一点毛病我的code?或者,问题是其他地方。

解决方案

 #480周
   #######################################
### Apache配置指令###
###为mod_gzip的1.3.26.1a ###
#######################################

##########################
###加载模块###
##########################

#------------------------------------------------- --------------------
#加载DLL / Win32的:
#的LoadModule gzip_module模块/ ApacheModuleGzip.dll
#
#加载DSO / UNIX:
#的LoadModule gzip_module模块/ mod_gzip.so
#
#(无两,如果模块在静态编译;

#确切的文件名可能取决于所用的确切的编译方法
#此模块)

#------------------------------------------------- --------------------

  < ifModule mod_gzip.c>

########################
###职责###
########################

#------------------------------------------------- --------------------
#使用mod_gzip的呢?
  mod_gzip_on是
#(你可以特别允许mod_gzip的中央服务器内
#配置,但禁止它里面的一些目录催产素虚
#主机通过使用此指令。)
#------------------------------------------------- --------------------

######################################
###静态preCOM pressed文件###
######################################

#------------------------------------------------- --------------------
#让MOD_GZIP执行部分内容协商?
  mod_gzip_can_negotiate是
#(如果此选项处于活动状态和一个静态文件中的COM送达
#pressed的,那么mod_gzip的将寻找一个静态的preCOM pressed
#版本的文件定义的附加扩展的 - 看下
#指令 - 这将优先交付。这将允许
#避免重复COM preSS相同的静态文件,因此
#节省了CPU时间。
#这个文件的任何动态缓存提供;当前用户
#本人负责创建和更新preCOM pressed
#文件的内容。

#从版本1.3.19.2a mod_gzip的自动识别是否
#静态preCOM pressed文件是旧比uncom pressed
#原始和在这种情况下,所服务的原稿的内容
在uncom $ P $#文件pssed形式 - 以而成为正确的数据比
#过时的...)

#------------------------------------------------- --------------------

#扩展名(后缀)的静态preCOM pressed文件
  mod_gzip_static_suffix。广州
  AddEncoding GZIP。广州
#(效果:见previous指令,这个字符串将被追加到
原始文件的#名。
#一定要配置编码GZIP这个扩展为好,
#因为mod_gzip的不符合的内容本身,而只是产生
#在Apache内部重定向到这个URL。因此,剩下的
#Apache配置负责制定了内容编码
#头妥善...
#之前的版本1.3.19.2a这个值是不可配置。)

#------------------------------------------------- --------------------

#自动更新静态preCOM pressed文件
  mod_gzip_update_static否
#(如果设置为是,该指令(即新版本1.3.26.1a)会
#原因mod_gzip的自动更新过时的版本中的任
#静态preCOM $ P $请求期间pssed文件,我。即COM preSS的
#最初请求的文件并覆盖preCOM pressed变种
它#文件!
#针对此类型的每个自动更新,mod_gzip的将消息写入
#严重性通知到Apache的error_log的。
#在这样做时,mod_gzip的直接读取原始文件的内容。
#因此该内容无法被任何其他Apache模块PTED除$ P $
#请求时。这有可能会不是你想要的东西 - 希望
#这将是大多数用户想要的,因为它的工作速度快这种方式。
#使用这种配置有很多照顾,并确保你不
#无意中造成宝贵的文件中的URL树被覆盖。
#这是不被用于大规模的主机服务器的特征,特别是
#因为mod_gzip的可能会遇到的访问控制问题存在 - 的
#参数userid的Apache进程是根据需要有写入权限运行
#为preCOM pressed所有用户的文件,这些文件可能无法自动
# 案子。)
在这种情况下,#[mod_gzip的错误处理???什么将送达?]

#------------------------------------------------- --------------------

###################
### 官僚 ###
###################

#------------------------------------------------- --------------------
对于mod_gzip的#显示状态
  mod_gzip_command_version/ mod_gzip_status
#(定义显示mod_gzip的状态的网址,可以指定
#单独为每个安装,并通过防止访问
#<地点>部分出于保护隐私)
#------------------------------------------------- --------------------
#状态显示如下所示:
#mod_gzip的可...
#mod_gzip_version = 1.3.26.1a
#mod_gzip_on = YES / NO
#,从而将提供有关的信息
# -  mod_gzip的被安装在服务器和正常工作,
# - 该版本已安装
# - 无论是mod_gzip的已设置激活这个位置
#( - > mod_gzip_on)
#------------------------------------------------- --------------------

#######################
### 数据管理 ###
#######################

#------------------------------------------------- --------------------
临时文件和COM pression缓存#工作目录
#如果没有指定,以下使用默认值:
#[Win32的= C:温度],[UNIX = / tmp目录]
#mod_gzip_temp_dir / tmp目录
#(此目录必须已经存在和正在使用的用户标识
#运行Apache服务器必须具有读取和写入此
#  目录。
#不像其他的Apache指令绝对路径名称必须指定
#  这里;一个相对值不会PTED相对于ServerRoot的跨$ P $。
#这pastname一定不能终止'/'。
#为了获得最佳性能这个目录应该位于RAM磁盘上,
#如果文件系统是不是已经被有效地缓存
#------------------------------------------------- --------------------
#保存临时工作文件[是,否]
  mod_gzip_keep_workfiles否
#(每个HTTP请求的一个文件 - 设置为是仅供调试!)
#------------------------------------------------- --------------------

##################
###文件大小###
##################

#------------------------------------------------- --------------------
#最小尺寸(以字节为单位)文件是COM pressed
  mod_gzip_minimum_file_size 500
#(非常小的文件,COM pression会产生只有很小的绝对收益
#[你将仍然节省约50%的含量,但一些附加
#500字节的HTTP和TCP报头将永远留uncom pressed]
#但是仍然会产生CPU负载的客户端和服务器。
#mod_gzip的自动比300字节设置较小的值
#这个指令的正是这个值300)
#------------------------------------------------- --------------------
#最大大小(以字节为单位)文件是COM pressed
  mod_gzip_maximum_file_size 500000
#(适用于非常大的文件COM pression最终可能需要相当长的和
#从而延缓传输的开始。
#Furthermode限制在这一点prevents从服务器
#生产无大小限制的输出情况下,一些死循环
#一个CGI脚本中 - 甚至试图COM preSS流数据 - 
#否则可能导致创建的临时文件
#任何尺寸,甚至填满整个硬盘。
#另一方面,玉米pression将有一个更可感知
对于大文件#主观效果......所以一定要微调此
#根据您的要求。)
#------------------------------------------------- --------------------
#最大大小(以字节为单位)文件是COM pressed内存
  mod_gzip_maximum_inmem_size 60000
#(大文件将COM pressed到临时文件目录;适应
#这个价值,你的服务器的可用主内存。
#在mod_gzip的1.3.19.x较大的值会自动限制
#60000因为一些操作系统据说有问题
#拨出超过64 KB内存的时间。
#------------------------------------------------- --------------------

####################
###要求###
####################

#(使用这些指令时,见关于缓存的问题。)
#------------------------------------------------- --------------------
客户端#所需的HTTP版本
#可能的值:1000 = HTTP / 1.0,1001 = HTTP / 1.1,...
#这个指令使用了相同的数字协议值作为Apache的呢
#内部
  mod_gzip_min_http 1000
#(通过使用这个指令,你可以排除旧的浏览器,搜索引擎
#从COM pression程序等:如果用户代理不
#宣布自己能够理解,至少在HTTP水平
#在这里说明,只有uncom pressed数据将被传递 - 不管
#什么它声称能。对1001的值将特别
#排除与Netscape 4.x和很多代理服务器。)
#------------------------------------------------- --------------------

要处理#HTTP方法
#可能的值:GET,POST或两者值的列表。
  mod_gzip_handle_methods GET POST
#(通过使用这个指令,你可以特别排除POST请求
#从COM pression程序。有公知的情况下
#处理这些请求由previous mod_gzip的版本可能会导致
#问题。
#版本1.3.19.2a在此之前价值不配置)。

#------------------------------------------------- --------------------

###############
###过滤器###
###############

#------------------------------------------------- --------------------
#哪些文件是COM pressed?
#
#加工过程中每两个阶段的顺序并不重要,
#但是引发的请求的内容这一要求的COM pression
#一)必须匹配至少一个包含规则在每个两相和
#B)不能匹配任何两个阶段排除规则。
#这些规则是不是最小的,他们是为了作为例子而已。
#

#注意,指令在这部分中的所有参数值
#评为常规EX pressions,而不是在一个区分大小写的方式。

#------------------------------------------------- --------------------
#第1阶段:(reqheader,URI,文件处理程序)
#========================================
#NO:特破的浏览器这对gzip压缩的内容请求
#但不能正确处理
  mod_gzip_item_exclude reqheader用户代理:Mozilla的/ 4.0 [678]

#从版本1.3.19.2a上我建议不要使用过滤器
#为用户剂,因为这会导致HTTP报头有所不同:用户代理
要生成#,因此使得为代理服务器的生活更加困难。

#
#JA:HTML-Dokumente
  mod_gzip_item_include文件的.html $
#
#NO:包括文件/ JavaScript的&放大器; CSS(由于Netscape4错误)
  mod_gzip_item_exclude文件的.js $
  mod_gzip_item_exclude文件的CSS $
#
#YES:CGI脚本
  mod_gzip_item_include文件特等$
  mod_gzip_item_include处理^ CGI脚本$
#
#第2阶段:(哑剧,rspheader)
#===========================
#YES:普通的HTML文件,普通的文本文件,Apache的目录列表
  mod_gzip_item_include哑剧^ text / html的$
  mod_gzip_item_include哑剧^纯文本/ $
  mod_gzip_item_include哑剧^的httpd / UNIX目录$
#
#NO:图像(GIF等,很少会保存任何东西)
  mod_gzip_item_exclude MIME ^图像/
#------------------------------------------------- --------------------
#事实上mod_gzip的是检查1号只有前4个字符
#即使是第2个字符而已,至于操作数(如果URI的
#允许像URL值)。
#------------------------------------------------- --------------------
#为mod_gzip_item规则表(包括和排除)不能含有
#超过256项;当超过这个数字,mod_gzip的会
#输出消息mod_gzip的:ERROR:项目指标已满
#和报告配置错误的Apache服务器。
#------------------------------------------------- --------------------
#这里描述的指令值是为了描述请求
#当选COM pression最精确地。
特别是对于哑剧规则#它必须明确指出,HTTP
#头的Content-Type(将由mod_gzip的这条规则被选中)
#在某些情况下可能不仅仅包含一个MIME类型,而另外一
#字符集描述(字符集)也是如此。
#如果这是要处理的请求,那么你需要的情况下,
#删除$字符的对应值的末尾所以现在
#这个值只有preFIX将用于匹配测试。
#------------------------------------------------- --------------------

##########################
###传输编码###
##########################

#------------------------------------------------- --------------------
#允许mod_gzip的消除HTTP头
#传输编码:分块
#并加入块一(COM pressable)包
  mod_gzip_dechunk是
#(此进行处理,需要多种类型的动态生成
#内容,特别是对于CGI和SSI页面,也用于产生页面
#一些的Java Servlet除preters。
#------------------------------------------------- --------------------

###############
###记录###
###############

#------------------------------------------------- --------------------
#扩展日志格式(用于测试COM pression效果)
  的LogFormat%H%1%U%T%V%R%< S%B mod_gzip的:%{mod_gzip_result} N的:%{mod_gzip_input_size} N  - <输出:%{mod_gzip_output_size} N =%{mod_gzip_com pression_ratio} n的PCT。 common_with_mod_gzip_info2
#------------------------------------------------- --------------------
#创建额外的日志文件
  的CustomLog日志/ mod_gzip.log common_with_mod_gzip_info2
#(当然,你可以重新定义你的正常的日志文件格式,但你MAL好
#信守格式标准进行评估通过标准的网络兼容
#分析工具。所以,我们只是创建另一个日志文件。)
#------------------------------------------------- --------------------
Apache的访问日志里面的交付文件#量计算:
#计数HTTP标头的大小(以字节为单位)的总产出规模的一部分
  mod_gzip_add_header_count是
#(这将是比纯文件的内容,但它会更
#实事求是地描述了HTTP请求的总输出流量)
#------------------------------------------------- --------------------

###############
###代理###
###############

#------------------------------------------------- --------------------
#发送因人而异HTTP标头
  mod_gzip_send_vary在
#(见约缓存此指令。)
#不改变这一点,除非你绝对知道你在做什么!
#------------------------------------------------- --------------------

  < / ifModule>
 

试试这个:)

WordPress如何开启Gzip压缩加速访问提升网站性能

I want to compress my webpage contents using gzip compression and for this purpose, I am using the following code in my .htaccess file, but it is not working

# BEGIN Compress text files
<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
# END Compress text files

I am using This Tool to test the gzip compression, but this tool tell that there is no gzip compression in my webpage.

Is there any thing wrong with my code ? Or problem is somewhere else.

解决方案

    # 480 weeks
   #######################################
### Apache configuration directives ###
###   for mod_gzip 1.3.26.1a        ###
#######################################

##########################
### loading the module ###
##########################

# ---------------------------------------------------------------------
# load DLL / Win32:
# LoadModule gzip_module modules/ApacheModuleGzip.dll
#
# load DSO / UNIX:
# LoadModule gzip_module modules/mod_gzip.so
#
# (none of both if module has been compiled in statically;

#  the exact file name may depend upon the exact compilation method used
#  for this module)

# ---------------------------------------------------------------------

  <ifModule mod_gzip.c>

########################
### responsibilities ###
########################

# ---------------------------------------------------------------------
# use mod_gzip at all?
  mod_gzip_on                   Yes
# (you can especially enable mod_gzip inside the central server
#  configuration but disable it inside some directories ot virtual
#  hosts by using this directive.)
# ---------------------------------------------------------------------

######################################
### statically precompressed files ###
######################################

# ---------------------------------------------------------------------
# let mod_gzip perform 'partial content negotiation'?
  mod_gzip_can_negotiate        Yes
# (if this option is active and a static file is to be served in com-
#  pressed for, then mod_gzip will look for a static precompressed
#  version of this file with a defined additional extension - see next
#  directive - which would be delivered with priority. This would allow
#  for avoiding to repeatedly compress the same static file and thus
#  saving CPU time.
#  No dynamic caching of this file is provided; currently the user
#  himself is responsible for creating and updating the precompressed
#  file's content.

#  From version 1.3.19.2a mod_gzip automatically recognizes whether
#  a statically precompressed file is older than its uncompressed
#  original and in this case will serve the content of the original
#  file in uncompressed form - as to rather serve correct data than
#  outdated ones ...)

# ---------------------------------------------------------------------

# extension (suffix) for statically precompressed files
  mod_gzip_static_suffix        .gz
  AddEncoding              gzip .gz
# (effect: see previous directive; this string will be appended to the
#  name of the original file.
#  be sure to configure the encoding 'gzip' for this extension as well,
#  because mod_gzip doesn't serve the content itself but simply generates
#  an Apache internal redirection to this URL. Therefore the remaining
#  Apache configuration is responsible for setting the 'Content-Encoding'
#  header properly ...
#  prior to version 1.3.19.2a this value was not configurable.)

# ---------------------------------------------------------------------

# automatic updates for statically precompressed files
  mod_gzip_update_static        No
# (if set to 'Yes', this directive (being new in version 1.3.26.1a) would
# cause mod_gzip to automatically update an outdated version of any
# statically precompressed file during the request, i. e. compress the
# originally requested file and overwrite the precompressed variant
# file with it!
# for each automatic update of this type, mod_gzip will write a message
# of the severity 'notice' into the Apache error_log.
# while doing so, mod_gzip will directly read the original file's content.
# therefore this content cannot be interpreted by any other Apache module
# during the request. this might possibly not be what you want - hopefully
# it will be what most users want, because it works fast this way.
# use this configuration with a lot of care, and be sure that you don't
# inadvertantly cause valuable files within the URL tree to be overwritten.
# this isn't a feature to be used for mass hosting servers, especially
# because mod_gzip might experience access control problems there - the
# userid the Apache processes are running under need to have write access
# to the precompressed files of all users, which may not automatically be
# the case.)
# [mod_gzip error handling in this situation??? what will be served?]

# ---------------------------------------------------------------------

###################
### bureaucracy ###
###################

# ---------------------------------------------------------------------
# display status for mod_gzip
  mod_gzip_command_version      '/mod_gzip_status'
# (defines an URL to display the status of mod_gzip; can be specified
# individually for each installation and protected against access via
# <location> section for privacy reasons)
# ---------------------------------------------------------------------
# The status display will look like this:
#       mod_gzip is available...
#       mod_gzip_version = 1.3.26.1a
#       mod_gzip_on = Yes/No
# and thus will provide information about
# - mod_gzip being installed at the server and working correctly,
# - which version has been installed and
# - whether mod_gzip has been set 'active' for this Location
#   (-> mod_gzip_on)
# ---------------------------------------------------------------------

#######################
### data management ###
#######################

# ---------------------------------------------------------------------
# Working directory for temporary files and the compression cache
# if not specified, the following default values are used:
# [Win32=c:temp], [UNIX=/tmp]
# mod_gzip_temp_dir             /tmp
# (This directory must already exist and the userid being used for
#  running the Apache server must have read and write access to this
#  directory.
#  Unlike other Apache directives an absolute path name must be specified
#  here; a relative value will not be interpreted relatively to ServerRoot.
#  This pastname must NOT be terminated with '/'.
#  For maximum performance this directory should be located on a RAM disk,
#  if the file system isn't already being cached efficiently
# ---------------------------------------------------------------------
# Save temporary work files [Yes, No]
  mod_gzip_keep_workfiles       No
# (one file per HTTP request - set to 'yes' for debugging purpose only!)
# ---------------------------------------------------------------------

##################
### file sizes ###
##################

# ---------------------------------------------------------------------
# minimum size (in bytes) for files to be compressed
  mod_gzip_minimum_file_size    500
# (for very small files compression will produce only small absolute gains
#  [you will still save about 50% of the content, but some additional
#  500 bytes of HTTP and TCP headers will always remain uncompressed],
#  but still produce CPU load for both client and server.
#  mod_gzip will automatically set smaller values than 300 bytes for
#  this directive to exactly this value 300.)
# ---------------------------------------------------------------------
# maximum size (in bytes) for files to be compressed
  mod_gzip_maximum_file_size    500000
# (for very large files compression may eventually take rather long and
#  thus delay the start of the transmission.
#  Furthermode a limitation at this point prevents the server from
#  producing output of unlimited size in case of some endless loop
#  inside a CGI script - or even trying to compress streaming data -
#  which might otherwise cause the creation of a temporary file of
#  any size and even fill up the whole hard disk.
#  On the other hand, compression will have a much more perceivable
#  subjective effect for large files ... so be sure to fine-tune this
#  according to your requirements.)
# ---------------------------------------------------------------------
# maximum size (in bytes) for files to be compressed in memory
  mod_gzip_maximum_inmem_size   60000
# (larger files will be compressed into the temp file directory; adapt
#  this value to your server's available main memory.
#  In mod_gzip 1.3.19.x larger values will automatically be limited to
#  60000 because some operating systems are said to have problems
#  allocating more than 64 kb of memory at a time.
# ---------------------------------------------------------------------

####################
### requirements ###
####################

# (see chapter about caching for problems when using these directives.)
# ---------------------------------------------------------------------
# Required HTTP version of the client
# Possible values: 1000 = HTTP/1.0, 1001 = HTTP/1.1, ...
# This directive uses the same numeric protocol values as Apache does
# internally
  mod_gzip_min_http             1000
# (By using this directive you may exclude old browsers, search engines
#  etc. from the compression procedure: if the user agent doesn't
#  declare itself capable of understanding at least the HTTP level
#  specified here, only uncompressed data will be delivered - no matter
#  what else it claims to be able to. The value of '1001' will especially
#  exclude Netscape 4.x. and a lot of proxy servers.)
# ---------------------------------------------------------------------

# HTTP methods to be handled
# Possible values: 'GET', 'POST' or a list of both values.
  mod_gzip_handle_methods        GET POST
# (By using this directive you may particularly exclude POST requests
#  from the compression procedure. There are known cases where the
#  handling of these requests by previous mod_gzip versions could cause
#  problems.
#  Before version 1.3.19.2a this value was not configurable.)

# ---------------------------------------------------------------------

###############
### filters ###
###############

# ---------------------------------------------------------------------
# which files are to be compressed?
#
# The order of processing during each of both phases is not important,
# but to trigger the compression of a request's content this request
# a) must match at least one include rule in each of both phases and
# b) must not match an exclude rule in any of both phases.
# These rules are not minimal, they are meant to serve as example only.
#

# Note that all parameter values of the directives in this section are
# evaluated as regular expressions, and not in a case-sensitive way.

# ---------------------------------------------------------------------
# phase 1: (reqheader, uri, file, handler)
# ========================================
# NO:   special broken browsers which request for gzipped content
#       but then aren't able to handle it correctly
  mod_gzip_item_exclude         reqheader  "User-agent: Mozilla/4.0[678]"

# From version 1.3.19.2a on I advise against using filters
# for User-agents, as this will cause HTTP-Headers 'Vary: User-Agent'
# to be generated, thus making life more difficult for proxy servers.

#
# JA:   HTML-Dokumente
  mod_gzip_item_include         file       .html$
#
# NO:   include files / JavaScript & CSS (due to Netscape4 bugs)
  mod_gzip_item_exclude         file       .js$
  mod_gzip_item_exclude         file       .css$
#
# YES:  CGI scripts
  mod_gzip_item_include         file       .pl$
  mod_gzip_item_include         handler    ^cgi-script$
#
# phase 2: (mime, rspheader)
# ===========================
# YES:  normal HTML files, normal text files, Apache directory listings
  mod_gzip_item_include         mime       ^text/html$
  mod_gzip_item_include         mime       ^text/plain$
  mod_gzip_item_include         mime       ^httpd/unix-directory$
#
# NO:   images (GIF etc., will rarely ever save anything)
  mod_gzip_item_exclude         mime       ^image/
# ---------------------------------------------------------------------
# In fact mod_gzip is checking only the first 4 characters of the 1st
# operand (in case of uri even the first 2 characters only, as to
# allow for values like url).
# ---------------------------------------------------------------------
# The table for mod_gzip_item rules (include and exclude) cannot contain
# more than 256 entries; when this number is exceeded mod_gzip will
# output the message "mod_gzip: ERROR: Item index is full"
# and report a configuration error to the Apache server.
# ---------------------------------------------------------------------
# The directive values described here are meant to describe the requests
# elected for compression most exactly.
# Especially for the mime rules it has to be made clear that the HTTP
# header 'Content-Type' (that will be checked by mod_gzip for this rule)
# in some cases may contain not only a MIME type but additionally a
# character set description (charset) as well.
# If this is the case for the requests to be handled then you need to
# remove the '$' char at the end of the corresponding value so that now
# only the prefix of this value will be tested for matching.
# ---------------------------------------------------------------------

##########################
### transfer encodings ###
##########################

# ---------------------------------------------------------------------
# Allow mod_gzip to eliminate the HTTP header
#    'Transfer-encoding: chunked'
# and join the chunks to one (compressable) packet
  mod_gzip_dechunk              Yes
# (this is required for handling several types of dynamically generated
# contents, especially for CGI and SSI pages, but also for pages produced
# by some Java Servlet interpreters.
# ---------------------------------------------------------------------

###############
### logging ###
###############

# ---------------------------------------------------------------------
# Extended log format (for testing the compression effect)
  LogFormat                     "%h %l %u %t "%V %r" %<s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n -< Out:%{mod_gzip_output_size}n = %{mod_gzip_compression_ratio}n pct." common_with_mod_gzip_info2
# ---------------------------------------------------------------------
# Create additional log file
  CustomLog                     logs/mod_gzip.log common_with_mod_gzip_info2
# (surely you can redefine your normal log file format, but you mal well
#  keep its format standard compatible for evaluation by standard web
#  analysis tools. So we just create another log file.)
# ---------------------------------------------------------------------
# Volume computation of the delivered files inside the Apache access_log:
# count HTTP header size (in bytes) as part of total output size
  mod_gzip_add_header_count     Yes
# (This will be more than the pure document content, but it will more
#  realistically describe the total output traffic of the HTTP request)
# ---------------------------------------------------------------------

###############
### proxies ###
###############

# ---------------------------------------------------------------------
# sending a 'Vary' HTTP header
  mod_gzip_send_vary            On
# (see chapter about caching for this directive.)
#  don't change this unless you absolutely know what you are doing!
# ---------------------------------------------------------------------

  </ifModule>

Try this :)

 
精彩推荐
图片推荐