我在IBM HTTP Server v7.0中启用了gzip
压缩。在回复标题中,我可以将Vary
视为“accept-encoding
”。
但是当我比较加载了gzip
和没有gzip
的文件的大小时,没有区别。我不确定我是否在做
这是正确的方式。
这是我在httpd.conf
文件中添加的内容
LoadModule deflate_module modules/mod_deflate.so
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript
你能帮帮我吗?
答案 0 :(得分:2)
尝试以下代码并根据需要进行更改:
LoadModule deflate_module modules/mod_deflate.so
DeflateCompressionLevel 9
DeflateMemLevel 9
DeflateWindowSize 15
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate
<Location />
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>