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";
    }
相关推荐
〆、风神30 分钟前
面试真题 - 高并发场景下Nginx如何优化
java·nginx·面试
呦呦鹿鸣Rzh9 小时前
缓存的相关内容
缓存
dddaidai12310 小时前
Redis解析
数据库·redis·缓存
noravinsc11 小时前
国产化中间件 替换 nginx
运维·nginx·中间件
Chasing__Dreams13 小时前
Redis--基础知识点--26--过期删除策略 与 淘汰策略
数据库·redis·缓存
ZHOU_WUYI13 小时前
使用 Docker 部署 React + Nginx 应用教程
nginx·react.js·docker
源远流长jerry13 小时前
MySQL的缓存策略
数据库·mysql·缓存
hudawei99618 小时前
flutter缓存网络视频到本地,可离线观看
flutter·缓存·音视频
小哈里18 小时前
【pypi镜像源】使用devpi实现python镜像源代理(缓存加速,私有仓库,版本控制)
开发语言·python·缓存·镜像源·pypi
CircleMouse18 小时前
基于 RedisTemplate 的分页缓存设计
java·开发语言·后端·spring·缓存