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";
    }
相关推荐
Hover_Z_快跑几秒前
Docker 部署 Elasticsearch 8.12 + Kibana + Nginx 负载均衡
nginx·elasticsearch·docker
Irene19911 小时前
前端缓存技术和使用场景
前端·缓存
小吕学编程2 小时前
缓存三部曲:从线程到分布式
缓存
huazeci2 小时前
deepin Ubuntu/Debian系统 环境下安装nginx,php,mysql,手动安装,配置自己的项目
nginx·ubuntu·debian
LB21122 小时前
Redis黑马点评 Feed流
数据库·redis·缓存
苦学编程的谢4 小时前
Redis_5_单线程模型
数据库·redis·缓存
JanelSirry6 小时前
Java + Spring Boot + Redis技术栈,在实际使用缓存时遇到 缓存击穿、缓存穿透、缓存雪崩
java·spring boot·缓存
m0_748248028 小时前
Redis 简介与安装指南
数据库·redis·缓存
cr7xin16 小时前
缓存三大问题及解决方案
redis·后端·缓存
爱怪笑的小杰杰16 小时前
浏览器端缓存地图请求:使用 IndexedDB + ajax-hook 提升地图加载速度
ajax·okhttp·缓存