nginx配置不缓存资源

方法1

conf 复制代码
        location / {
            index  index.html index.htm;
            add_header Cache-Control no-cache,no-store;
            try_files $uri $uri/ /index.html;
            #include mime.types;
            if ($request_filename ~* .*\.(htm|html)$) 
            {
              add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
            }
        }

方法2

conf 复制代码
        location / {
            index  index.html index.htm;
            add_header Cache-Control no-cache,no-store;
            try_files $uri $uri/ /index.html;
            #include mime.types;
            #if ($request_filename ~* .*\.(htm|html)$) 
            #{
            #  add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
           # }
        }
       location = /index.html {
            #add_header Cache-Control "no-cache, no-store, must-revalidate";
            add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
            add_header Pragma "no-cache";
            add_header Expires "0";
    }
相关推荐
吴声子夜歌4 小时前
Redis 5.x——布隆过滤器
数据库·redis·缓存
donoot10 小时前
一次 Nginx 502 问题的深度排查:从 SELinux 到容器网络
nginx·docker·selinux·反向代理·502 bad gateway
斯蒂文66813 小时前
[MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
缓存·中间件
難釋懷15 小时前
Nginx浏览器强制缓存
运维·nginx·缓存
诚信定制83915 小时前
如何启动 Redis 服务:详细步骤指南
数据库·redis·缓存
cxr82816 小时前
缓存策略探测实验 — 综合执行方案
java·开发语言·缓存
cxr82817 小时前
缓存策略探测实验方案架构设计
缓存
大江东去浪淘尽千古风流人物17 小时前
【KV-Tracker】实时位姿跟踪:用KV缓存将多视图Transformer加速15倍
深度学习·缓存·transformer·3d重建·kv-tracker·实时位姿跟踪
ITKEY_1 天前
macOS brew 安装的nginx 文件在哪里?
运维·nginx·macos
Felix-lxd1 天前
Ubuntu 22.04 配置 Nginx
linux·nginx·ubuntu