我的apache web服務器管理員聲稱,服務器支持deflate gzip壓縮並且出於某種原因,向我顯示環境變量HTTP_ACCEPT_ENCODING gzip,deflate
。Apache服務器壓縮和槓桿瀏覽緩存問題
我知道有兩種壓縮方法。方法之一,是在PHP水平,使用ob_start('ob_gzhandler')
和第二個方法是在服務器級別,使用.htaccess
在它一些命令,像這樣的
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
我用一些工具檢查兩種壓縮方法,如page speed
第一種方法適用於我,但第二種方法不起作用。 我想使用服務器端壓縮方法,並且我發現網絡中有很多人有像我這樣的問題。 服務器管理員只是聲稱everything is ok from his point of view and gzip/deflate is active
我有leverage browse caching
其他問題,谷歌推薦網站管理員使用它。
就像壓縮,有標準編碼.htaccess
文件,像這樣的
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
不幸的是,這是行不通的像壓縮。 我們的apache服務器版本是2.2.20。
我不知道如何證明服務器管理員,這是有問題的服務器安裝。
也許是這個版本的apache的bug。 我真的很迷惑,特別是當我明白世界上有一些人,他們和我一樣有同樣的問題,而且沒有回覆。
Thanks..very不錯......我不知道......嫋嫋我下載它,它適合你的例子,非常漂亮不幸的是,當我使用它像'curl --compress http:// www.mysite.com'它返回'406不可接受的錯誤!....我爲我的新錯誤創建了新的問題。請參閱此[鏈接](http://stackoverflow.com/questions/8653271/curl-command-return-http-1-1-406-not-acceptable-error)...但沒有有用的回覆..這些問題到底是什麼?!...誰是救贖者?!...你可以布賴恩...我知道你是男人布萊恩。 – 2011-12-28 09:03:29