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";
    }
相关推荐
xhbh6661 小时前
中小企业 Redis 运维,如何安全归档 RDB、AOF 备份文件?
运维·数据库·缓存·数据备份·文件备份·同步备份·号码备份
Wang's Blog9 小时前
Java框架快速入门: Spring Security+OAuth2之多因子认证缓存服务
java·spring·缓存
雪芽蓝域zzs9 小时前
第三十六节:keep-alive 页面缓存(Vue3 + 后台管理系统)
前端·vue.js·缓存
我是苏苏9 小时前
Redis开发09:Windows系统下主从复制的配置教程
数据库·redis·缓存
运维全栈笔记9 小时前
Ansible 自动化 Nginx 集群部署实战:动态 Inventory、滚动发布与 Role 工程化
nginx·自动化·ansible
mengzhi啊19 小时前
缓存类CacheDataManager把临时数据存入json。做成插件·
qt·缓存·json
小lu飞1 天前
DeepSeek Flash 降价的技术账本:缓存友好型定价如何改写推理成本结构
缓存
hweiyu001 天前
Redis命令:APPEND
redis·缓存
敲代码的嘎仔1 天前
从集群锁失效到异步领券:我用分布式锁 + Redisson + MQ 把领券接口 RT 从 200ms 压到 15ms
java·数据库·redis·分布式·缓存·ai·wpf
MetaLite1 天前
Spring Cache只留注解-MetaLite如何二开缓存运行时
java·spring·缓存