nginx两种缓存机制

参见:
https://blog.csdn.net/solmyr_biti/article/details/78612726

https://blog.csdn.net/lmd1997130/article/details/78542813

这里只介绍nginx配置expires,让浏览器对静态资源进行缓存,配置如下:

location ~ .*\.(png|gif|ico|jpg|jpeg|eot|svg|svgz|mp4|ogg|ogv|webm|ttf|woff)$ {
    root   F:\apache-tomcat-web\ROOT;
    expires      7d;
}

location ~ .*\.(js|css)$ {
    root   F:\apache-tomcat-web\ROOT;
    expires      7d;
}

不对html进行缓存

location ~ .*\.(htm|html)$ {
    root   F:\apache-tomcat-web\ROOT;
    add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}

原文出处:/show_1EF21zT5XFZ4.html