crespo09 发表于 2016-12-25 09:35:47

nginx及apache不缓存配置;

  今天碰见一个问题,我们要对页面实际展现量做一个统计,也不想给统计的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>




nginx:

location ~ .*\.(css|js|swf|php|htm|html )$ {
add_header Cache-Control no-store;
}
页: [1]
查看完整版本: nginx及apache不缓存配置;