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";
    }
相关推荐
千夜啊1 小时前
Nginx 运维开发高频面试题详解
运维·nginx·运维开发
java1234_小锋5 小时前
说说Redis的内存淘汰策略?
数据库·redis·缓存
2的n次方_9 小时前
【Redis】set 和 zset 类型的介绍和常用命令
数据库·redis·缓存
赵渝强老师10 小时前
【赵渝强老师】Spark RDD的依赖关系和任务阶段
大数据·缓存·spark
@_@哆啦A梦13 小时前
Nginx知识
运维·nginx
桂月二二13 小时前
使用 Redis Streams 实现高性能消息队列
数据库·redis·缓存
何似在人间5751 天前
Java的Integer缓存池
java·开发语言·缓存
繁梦溪1 天前
在Ubuntu子系统中基于Nginx部署Typecho
linux·nginx·ubuntu
maply1 天前
Redis 消息队列详解
数据库·redis·缓存
java1234_小锋1 天前
怎么实现Redis的高可用?
数据库·redis·缓存