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";
    }
相关推荐
zhengxianyi5151 天前
vue-cli build, vite build 生产部署刷新或弹窗404,页面空白修复方法
前端·javascript·vue.js·nginx·生产部署
難釋懷1 天前
Redis 通用命令
数据库·redis·缓存
2401_zq136y031 天前
Flutter for OpenHarmony:从零搭建今日资讯App(二十七)图片缓存的完整方案
flutter·缓存
2401_858286111 天前
从Redis 8.4.0源码看快速排序(1) 宏函数min和swapcode
c语言·数据库·redis·缓存·快速排序·宏函数
zhengxianyi5151 天前
vite build 发布到nginx二级目录——将yudao-ui-go-view打包、部署到big目录下
vue.js·nginx·vite·前后端分离·打包·ruoyi-vue-pro优化·部署运维
Codeking__1 天前
Redis——事务
数据库·redis·缓存
Codeking__1 天前
Redis——认识持久化、RDB、AOF
数据库·redis·缓存
什么都不会的Tristan1 天前
redis-原理篇-QuickList
数据库·redis·缓存
yuankunliu1 天前
【redis】2、Redis的Value的常见数据类型以及使用场景
redis·缓存
JH30731 天前
openfeign vs nginx 负载均衡对比
运维·nginx·负载均衡