Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Css 文件是从缓存中挑选出来的,所以我必须手动编辑文件版本style.css?v=2,例如强制缓存重置。
style.css?v=2
在我的电脑上一切正常,但很多人告诉他们,他们有旧版的 css 文件中的旧标志或旧设计。这意味着它们是从缓存中获取的。
如何通过 nginx 解决这个问题?
我已经在考虑将修改时间动态附加到所有 css 文件的解决方案style.css?v=%last file modify time%
style.css?v=%last file modify time%
我的 nginx conf 中唯一的缓存是这一行:
expires 1y;
When modified is omitted expires will allow the browser to cache a file based on the request time. Read the mod_header documentation for all the details.