我很想開始嘗試使用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