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";
    }
相关推荐
llm大模型算法工程师weng8 小时前
负载均衡做什么?nginx是什么
运维·开发语言·nginx·负载均衡
qq_5470261798 小时前
Java 中的 Caffeine 缓存详解
java·开发语言·缓存
fTiN CAPA8 小时前
服务器无故nginx异常关闭之kauditd0 kswapd0挖矿病毒 CPU占用200% 内存耗尽
运维·服务器·nginx
devilnumber9 小时前
Redis 使用过程中可能遇到的常见问题或 “坑”
数据库·redis·缓存
lKWO OMET10 小时前
查看 nginx 是否已经启动
运维·数据库·nginx
CDN36011 小时前
【踩坑实录】前端开发必看:一次由CSS缓存引发的线上事故与SEO反思
前端·css·缓存
Aray123412 小时前
Redis Cluster 集群选举机制
数据库·redis·缓存
ywlovecjy12 小时前
【Nginx 】Nginx 部署前端 vue 项目
前端·vue.js·nginx
hutengyi14 小时前
四、nginx的优化和location匹配规则
运维·nginx
eEKI DAND14 小时前
一个比 Nginx 还简单的 Web 服务器
服务器·前端·nginx