美文网首页
nginx缓存启用和禁用

nginx缓存启用和禁用

作者: dbc94a66f502 | 来源:发表于2019-07-19 17:18 被阅读0次

1.启用缓存

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$ {
  #设置缓存上面定义的后缀文件缓存到浏览器的生存时间
  expires   7d;
}

2.禁用缓存

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$ {
  #禁止缓存,每次都从服务器请求
  add_header Cache-Control no-store;
}

相关文章

网友评论

      本文标题:nginx缓存启用和禁用

      本文链接:https://www.haomeiwen.com/subject/npvslctx.html