2011-09-30 69 views
8

我目前在我的Apache配置中使用deflate緩存我的CSS,JS和圖像。在Apache中使用deflate緩存圖像,JS和CSS

這裏是我的代碼:

AddOutputFilterByType DEFLATE text/plain 
AddOutputFilterByType DEFLATE text/html 

AddOutputFilterByType DEFLATE text/xml 
AddOutputFilterByType DEFLATE application/xml 
AddOutputFilterByType DEFLATE application/xhtml+xml 
AddOutputFilterByType DEFLATE application/rss+xml 

AddOutputFilterByType DEFLATE text/css 
AddOutputFilterByType DEFLATE application/javascript 
AddOutputFilterByType DEFLATE application/x-javascript 

現在,當我檢查我的頭我看到:

Host    www.domain.com 
User-Agent   Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20100101 Firefox/6.0.2 
Accept    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Language  en-us,en;q=0.5 
Accept-Encoding  gzip, deflate 
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7 
Connection   keep-alive 
If-Modified-Since Fri, 30 Sep 2011 01:05:01 GMT 
If-None-Match  "124741af-1c4b9-4ae1136f3f9d0" 
Cache-Control  max-age=0 

一切看起來不錯,Accept-Encodinggzip, deflate這是我想要什麼,但現在我看到的Cache-Controlmax-age=0

這是否會使用deflate擊敗緩存的目的?這是否意味着它只緩存了1天,第二天它不會緩存它,否則它將不得不重新加載它?

注意:我的圖片很少變化,我的CSS和JS每週更換一次。

回答