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";
    }
相关推荐
写后端的胖头鱼11 小时前
一文详解Cache Aside(旁路缓存模式)
redis·缓存·延迟双删·缓存一致
code_slave(码畜)12 小时前
微服务架构落地:基础服务 —— 报表服务(中篇:元数据、查询引擎、缓存与权限落地)
spring boot·spring cloud·缓存·微服务·架构
life码农15 小时前
Nginx 配置允许指定 IP 段访问:从 192.168.1.1 到 192.168.1.124 及 /24 详解
网络·tcp/ip·nginx
吴声子夜歌16 小时前
Nginx应用与运维——Nginx编译及部署(部署)
java·运维·nginx
hweiyu0016 小时前
Redis命令:HPEXPIREAT
redis·缓存
code2cat16 小时前
【随笔】MCP缓存期限与共享范围:让Agent复用资料时记住边界
java·后端·缓存·ai agent·mcp
Wang's Blog18 小时前
Java 项目实战: 外卖平台优化-Nginx目录结构与conf配置文件体系
java·nginx
XS03010618 小时前
Nginx 学习指南
运维·nginx
吴声子夜歌19 小时前
Nginx应用与运维——Nginx代理服务应用实战(TCP/UDP代理)
运维·tcp/ip·nginx
吴声子夜歌19 小时前
Nginx应用与运维——Nginx缓存服务应用实战(一)
运维·nginx·缓存