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">
相关推荐
小羊没烦恼!12 小时前
微服务化的基石——持续集成
java·大数据·word·powerpoint·.net
俊昭喜喜里12 小时前
java中的继承和多态的区别
java
小羊没烦恼!12 小时前
初探性能优化——2个月到4小时的性能提升
java·开发语言·windows·算法·c#
譕痕13 小时前
JSONObject与JSONArray封装数据格式区别
java·json
胡写代码13 小时前
别再前后端各写一套表单校验了
java·后端
小鱼能吃糖13 小时前
缺陷修复总览 · mall电商项目:5类缺陷,1个病根,4个业务域
java·电商
还是大剑师兰特13 小时前
解决nginx错误:http://localhost:7000正常,http://localhost:7000/map 报错404
nginx·大剑师
此时不提桶,更待何时13 小时前
01-06-A-JVM排查实战详解
java·jvm
vipxieliang14 小时前
ValidX 在 DDD 领域驱动设计中的实践
java·spring boot
ba_pi14 小时前
mysql 查询所有表名并授权
java