nginx及apache不缓存配置

来源:互联网 发布:node.js excel 编辑:程序博客网 时间:2024/06/05 00:08

今天碰见一个问题,我们要对页面实际展现量做一个统计,也不想给统计的pvcall.png加上时间戳,其实用nginx和apache自己的配置即可解决此问题,提供下apache不缓存配置和nginx不缓存配置的设置。

apache:
首先确定配置文件httpd.conf中确已经加载mod_headers模块。若没有添加下面这段话

LoadModule headers_module modules/mod_headers.so
我们可以根据文件类型来让浏览器每次都从服务器读取,这里测试用css、js、swf、php、html、htm这几种文件。

<FilesMatch “\.(css|js|swf|php|htm|html)$”>      Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"      Header set Pragma "no-cache"  </FilesMatch>  
location ~ .*\.(css|js|swf|php|htm|html )$ {                add_header Cache-Control no-store;  }  
原创粉丝点击