在Apache中使用deflate缓存图像、JS和CSS

8

我当前正在使用deflate在我的Apache配置中缓存我的CSS、JS和图像。

以下是我的代码:

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每周更改一次。
1个回答

13

1
我喜欢第一个链接,谢谢它帮助我理解了区别。 - Tech4Wilco

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接