nginx设置Expires和Cache-Control

柔光的暖阳◎ 2022-07-15 12:27 324阅读 0赞

基本概念:

关于ExpiresCache-Control的作用于机制,用于缓存过期判断,这里不深入展开,有需要可以google/baidu。

注:Cache-Control的优先级高于Expires

nginx关于expires设置的官方说明:http://nginx.org/en/docs/http/ngx_http_headers_module.html

  1. Syntax: expires [modified] time;
  2. expires epoch | max | off;
  3. Default:
  4. expires off;
  5. Context: http, server, location, if in location

配置:

  1. location /hello {
  2. echo "hello world";
  3. expires 24h;
  4. }

测试:

SouthEast

原文出自:http://blog.csdn.net/daiyudong2020/article/details/53192311

End;

发表评论

表情:
评论列表 (有 0 条评论,324人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Redis Expire

    Redis Expire命令用于设定键有效期。到期时间后键不会在Redis中使用。 返回值 整数值1或0 1, 如果设置的键超时。