nginx设置不使用缓存

'''
conf/prod/nginx.conf
location / {
try_files uriuri/ /index.html;
alias /usr/share/nginx/html/;
if (request_filename ~ .*\.(htm|html)){
add_header Cache-Control no-cache;
}
}

D239D2C5-6382-4B95-8377-128B3C778F10.png

设置所有的html文件强制不缓存:
location ~ ..(htm|html)?{ add_header Cache-Control "no-store, no-cache"; } 设置某个目录下的html文件强制不缓存: location /user { if (request_filename ~ .*.(?:htm|html)$)
{
add_header Cache-Control "no-store, no-cache";
add_header Pragma no-cache;
add_header Expires 0;
}
}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容