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";
    }
相关推荐
我叫张小白。16 分钟前
基于Redis与FastAPI的分布式共享会话体系
数据库·redis·分布式·缓存·中间件·fastapi·依赖注入
難釋懷1 小时前
Nginx-Https证书配置
运维·nginx·https
绝知此事1 小时前
Redis 从入门到精通:Spring Boot 实战三部曲(一)—— 基础核心与快速上手
数据库·redis·缓存
YL200404261 小时前
【Redis实战篇】基于Redis的分布式锁的原理及实现
数据库·redis·缓存
风向决定发型丶1 小时前
Logrotate配置nginx日志切割
运维·nginx
fpcc1 小时前
C++编程实践——提高缓存的命中
c++·缓存
難釋懷2 小时前
Nginx自签名-OpenSSL
运维·chrome·nginx
闪电悠米2 小时前
黑马点评-优惠券秒杀-03_basic_seckill_and_oversell
java·数据库·spring boot·spring·缓存·oracle·面试
cfm_291412 小时前
Redis数据安全性解析
数据库·redis·缓存
辞忧九千七13 小时前
Redis 单机一主二从主从复制完整搭建指南
数据库·redis·缓存