Nginx配置不缓存html

Nginx配置不缓存html

    • [1. 配置nginx不缓存html](#1. 配置nginx不缓存html)
      • [1.1 修改配置文件](#1.1 修改配置文件)
      • [1.2 验证](#1.2 验证)
    • [2. Vue项目修改根目录index.html](#2. Vue项目修改根目录index.html)

1. 配置nginx不缓存html

1.1 修改配置文件

bash 复制代码
location / {
 expires 1h;
 root /home/html;
 index index.html index.htm;
 ## html不缓存 
 if ($request_filename ~* .*\.(htm|html)$){
     add_header Cache-Control "no-store";
 }
}

1.2 验证

2. Vue项目修改根目录index.html

html 复制代码
//head中添加以下代码,会使所有打css/js资源重新加载
<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
相关推荐
文丑颜不良啊2 小时前
LeetCode2161~2180题目解析
java·leetcode
文丑颜不良啊3 小时前
LeetCode2141~2160题目解析
java·leetcode
LabVIEW开发4 小时前
LabVIEW 连接板:28 个端子怎么排,优先级怎么定
java·算法·labview
天天被压力4 小时前
【A股分钟级高频数据完全手册 #07】北交所历史分钟K线接口:京市Pro版分时批量
java·人工智能·python
天天被压力4 小时前
【A股分钟级高频数据完全手册 #08】股票日、分时数据接口对比:普通分时与Pro版差异实测
java·人工智能·python
特立独行的猫A4 小时前
AI 时代,我为什么推荐用 cj-tauri 开发桌面应用
java·后端·python
金銀銅鐵5 小时前
从一个类名到一张类图:用反射自动生成 PlantUML
java·后端·uml
nice_lcj5205 小时前
Java 并发容器入门:ConcurrentHashMap、CopyOnWriteArrayList、阻塞队列
java·面试·并发编程·阻塞队列·concurrenthashmap·copyonwritearraylist
微小的鱼5 小时前
Linux的渲染与显示系统链路
android·java·linux
陈希1235 小时前
Nginx 从入门到能扛事:反向代理、负载均衡与 HTTPS 实战
nginx·https·负载均衡