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";
    }
相关推荐
hzk的学习笔记3 小时前
Redis除了做缓存还能用来干什么
数据库·redis·缓存
小杨互联网3 小时前
构建推理缓存以节省高流量 LLM 应用程序的成本
缓存·llm·大型语言模型
stark张宇4 小时前
攻克 CRMRB 部署难点:从 PHP 扩展、数据库配置到进程守护
nginx·centos·php
罗政5 小时前
【免费】轻量级服务器centos监控程序+内存+cpu+nginx+适合小型站长使用
服务器·nginx·centos
xujiangyan_13 小时前
Redis详解
数据库·redis·缓存
椎49518 小时前
苍穹外卖前端nginx错误之一解决
运维·前端·nginx
程序员小凯18 小时前
Spring Boot缓存机制详解
spring boot·后端·缓存
夜泉_ly21 小时前
Redis -持久化
数据库·redis·缓存
2351621 小时前
【LeetCode】146. LRU 缓存
java·后端·算法·leetcode·链表·缓存·职场和发展
2301_787328491 天前
25.负载均衡-Nginx、HAProxy、LVS 全解析
nginx·负载均衡·lvs