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";
    }
相关推荐
江上清风山间明月2 小时前
Nginx基于域名区分的多网站部署
运维·nginx·部署·php·多个网站
随风,奔跑3 小时前
Nginx
服务器·后端·nginx·web
高翔·权衡之境4 小时前
缓存一致性——多核系统的默契之约
驱动开发·嵌入式硬件·安全·缓存·系统安全·信息与通信
强壮的小白菜6 小时前
Nginx403
nginx
直奔標竿8 小时前
MySQL与Redis数据一致性实战方案(避坑指南)
java·数据库·spring boot·redis·mysql·spring·缓存
绿豆人9 小时前
Cache缓存项目学习4
windows·学习·缓存
angushine10 小时前
ffmpeg+nginx搭建HLS 推流
运维·nginx·ffmpeg
身如柳絮随风扬10 小时前
Nginx 核心配置与实战解析:从入门到进阶
运维·nginx
2501_9127840810 小时前
TaoCarts 反向海淘系统架构实战:1688代采与高并发缓存设计全解析
缓存·架构·系统架构·跨境电商·taocarts
S1998_1997111609•X12 小时前
超导致䗃系统固件损坏关闭进程函数洪水泛滥污染孪生镜像描述的逻辑串码缓存鸡dark and -blue 仺盀
安全·百度·缓存·哈希算法·量子计算