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">
相关推荐
budingxiaomoli6 小时前
Spring IoC &DI
java·spring·ioc·di
Spider Cat 蜘蛛猫6 小时前
Springboot SSO系统设计文档
java·spring boot·后端
未若君雅裁6 小时前
MySQL高可用与扩展-主从复制读写分离分库分表
java·数据库·mysql
学习中.........7 小时前
从扰动函数的变化,感受红黑树带来的性能提升
java
phltxy7 小时前
Redis 事务
数据库·redis·缓存
计算机安禾7 小时前
【c++面向对象编程】第24篇:类型转换运算符:自定义隐式转换与explicit
java·c++·算法
咚为7 小时前
比AccessLog更全面的原生Nginx 日志记录
运维·nginx·junit
weixin199701080168 小时前
【保姆级教程】淘宝/天猫商品详情 API(item_get)接入指南:Python/Java/PHP 调用示例与 JSON 返回值解析
java·python·php
环流_8 小时前
redis核心数据类型在java中的操作
java·数据库·redis
雨辰AI8 小时前
SpringBoot3 项目国产化改造完整流程|从 MySQL 到人大金仓落地
java·数据库·后端·mysql·政务