/ 中存储网

在Apache服务器中中开启gzip压缩

2014-04-01 10:15:01 来源:kejihao
一、检查模块:

[[email protected] httpd-2.2.16]# /application/apache/bin/httpd -l

Compiled in modules:

.................

  mod_deflate.c

.................

######################################

二、在Apache中开启gzip压缩

打开Apache配置文件,然后添加mod_deflate.so模块

vi /application/apache/conf/extra/httpd-vhosts.conf

标准的:

ServerAlias

#####需要添加的内容  ###

<ifmodule mod_deflate.c>

        DeflateCompressionLevel 9

        SetOutputFilter DEFLATE

        DeflateFilterNote Input instream

        DeflateFilterNote Output outstream

        DeflateFilterNote Ratio ratio

        #LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate

        #CustomLog logs/deflate_log.log deflate

</ifmodule>

##############################

ErrorLog

三、重启Apache

/application/apache/bin/apachectl -t

/application/apache/bin/apachectl graceful