First load Module
Loadmodule deflate_module modules/mod_deflate.so
Configuration method in Apache:
<Ifmodule deflate_module>
<Location/>
Browsermatch ^ Mozilla/4 gzip-only-text/html
Browsermatch ^ Mozilla/4/. 0 [678] No-Gzip
Browsermatch/bmsi [e]! No-gzip! Gzip-only-text/html
Setoutputfilter deflate
Addoutputfilterbytype deflate text/HTML text/plain text/XML text/CSS text/JavaScript
Setenvifnocase request_uri /.(? : GIF | JPG | cab | jpe? G | exe | BMP | MP3 | RAR | zip | SWF | PNG) $ no-gzip dont-vary
Header append vary User-Agent
</Location>
# Declare the number of bytes of the input stream
Deflatefilternote input instream
# Declare the number of bytes of the output stream
Deflatefilternote output outstream
# Declare the compression percentage
Deflatefilternote ratio Ratio
# Declare the Log Type
Logformat '% t "% R" % {outstream} n/% {instream} n (% {ratio} n %)' deflate
Customlog logs/deflate_log deflate
</Ifmodule>
You can also make the following simple configuration:
<Ifmodule deflate_module>
Setoutputfilter deflate
Addoutputfilterbytype deflate text/HTML text/plain text/XML text/CSS text/JavaScript
Setenvifnocase request_uri /.(? : GIF | JPG | cab | jpe? G | exe | BMP | MP3 | RAR | zip | SWF | PNG) $ no-gzip dont-vary
# Declare the number of bytes of the input stream
Deflatefilternote input instream
# Declare the number of bytes of the output stream
Deflatefilternote output outstream
# Declare the compression percentage
Deflatefilternote ratio Ratio
# Declare the Log Type
Logformat' "% R" % {outstream} n/% {instream} n (% {ratio} n %) 'deflate
Customlog logs/deflate_log deflate
</Ifmodule>
The following configurations can be used in ibm http Server:
<Location/>
Setoutputfilter deflate
Addoutputfilterbytype deflate text/HTML text/plain text/XML text/CSS text/JavaScript
Setenvif User-Agent ^ Mozilla/4 gzip-only-text/html
Setenvif User-Agent ^ Mozilla/4/. 0 [678] No-Gzip
Setenvif User-Agent/bmsie! No-Gzip
Setenvif User-Agent/bmsie! Gzip-only-text/html
Setenvifnocase request_uri/. (GIF | JPG | cab | jpe? G | exe | BMP | MP3 | RAR | zip | SWF | PNG) $ no-gzip dont-vary
</Location>
Deflatecompressionlevel 9
Deflatefilternote input instream
Deflatefilternote output outstream
Deflatefilternote ratio Ratio
# % H host, % t time, % R request URL
Logformat' "% H % L % u % T % R" % {outstream} n/% {instream} n (% {ratio} n %) 'deflate
Customlog logs/deflate_log deflate