麦壳社区Nginx

nginx 静态文件缓存配置

2020-05-22  本文已影响0人  张Boy
  location ~* ^.+\.(css|js|txt|xml|png|jpg|gif|jpeg|webp)$ {
        add_header Cache-Control no-store;
        add_header Cache-Control max-age=3600;
        add_header Cache-Control public;
        add_header Cache-Control only-if-cached;
        add_header Cache-Control no-cache;
        add_header Cache-Control must-revalidate;
  }

缓存请求指令集

  Cache-Control: max-age=<seconds>
  Cache-Control: max-stale[=<seconds>]
  Cache-Control: min-fresh=<seconds>
  Cache-control: no-cache 
  Cache-control: no-store
  Cache-control: no-transform
  Cache-control: only-if-cached

缓存响应指令集 [我们使用这里的配置]

  Cache-control: must-revalidate
  Cache-control: no-cache
  Cache-control: no-store
  Cache-control: no-transform
  Cache-control: public
  Cache-control: private
  Cache-control: proxy-revalidate
  Cache-Control: max-age=<seconds>
  Cache-control: s-maxage=<seconds>

可缓存性指令:

到期指令

其他指令/ 重加载

上一篇 下一篇

猜你喜欢

热点阅读