我很想开始尝试使用gzip,但正如我第一次开始学习php时发现php.net一样,apache文档让我感到困惑。 http://httpd.apache.org/docs/2.0/mod/mod_deflate.html有人能给我一个htaccess的示例gzip代码吗?
我真的很感激一个样本htaccess文件来看看是否有人有一个?
如果我启用服务器范围的gzipping,那么还有什么应该在httpd.conf文件中而不是htaccess中进行更改?
对不起,我是apache的新手!
编辑:
,所以我能够在httpd.conf mod_deflate模块,然后将以下为HT访问文件就可以了(作为一个例子)?
<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
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !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>
mod_deflate文档中的示例配置有什么问题(请参阅http://httpd.apache.org/docs/2.2/mod/mod_deflate.html#recommended)? – Gumbo 2010-06-10 08:14:23
有没有什么特别是你不明白的文档? – Artefacto 2010-06-10 08:16:07
该代码旨在用于服务器或虚拟主机配置(请参阅“”的环境:http://httpd.apache.org/docs/2.2/mod/core.html#location)。 –
Gumbo
2010-06-10 08:30:42