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";
    }
相关推荐
冰橙子id1 小时前
centos7编译安装LNMP架构
mysql·nginx·架构·centos·php
Zfox_14 小时前
Redis:Hash数据类型
服务器·数据库·redis·缓存·微服务·哈希算法
呼拉拉呼拉14 小时前
Redis内存淘汰策略
redis·缓存
咖啡啡不加糖18 小时前
Redis大key产生、排查与优化实践
java·数据库·redis·后端·缓存
肥仔哥哥193019 小时前
springCloud2025+springBoot3.5.0+Nacos集成redis从nacos拉配置起服务
redis·缓存·最新boot3集成
米粉030521 小时前
深入剖析Nginx:从入门到高并发架构实战
java·运维·nginx·架构
呼拉拉呼拉1 天前
Redis故障转移
数据库·redis·缓存·高可用架构
静水楼台x1 天前
nginx日志的一点理解
运维·nginx
篱笆院的狗1 天前
如何使用 Redis 快速实现布隆过滤器?
数据库·redis·缓存
欧先生^_^1 天前
ingress-nginx 开启 Prometheus 监控 + Grafana 查看指标
nginx·grafana·prometheus