最新消息:

apache不缓存配置;nginx不缓存配置

apache admin 3022浏览 0评论

在开发调试web的时候,经常会碰到因浏览器缓存(cache)而经常要去清空缓存或者强制刷新来测试的烦恼,提供下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;
}

转载请注明:爱开源 » apache不缓存配置;nginx不缓存配置

您必须 登录 才能发表评论!