禁用某些文件类型的Nginx缓存 [英] disable nginx caching for certain file types

查看:637
本文介绍了禁用某些文件类型的Nginx缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有nginx设置,充当apache的反向代理. 但是,我需要禁用gif的缓存. 如何在Nginx上执行此操作?

I have nginx setup, acting as a reverse proxy to apache. However, I need to disable caching for gifs. How can I do this on nginx?

谢谢

推荐答案

这应该可以解决问题:

set $no_cache "";
if ($request_uri ~* \.gif$) {
  set $no_cache "1";
}
proxy_no_cache $no_cache;
proxy_cache_bypass $no_cache;

这篇关于禁用某些文件类型的Nginx缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆