nginx设置Expires和Cache-Control



基本概念:

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

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


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

Syntax:	expires [modified] time;
expires epoch | max | off;
Default:	
expires off;
Context:	http, server, location, if in location



配置:

location /hello {
    echo "hello world";
    expires 24h;
}

测试:

nginx设置Expires和Cache-Control_第1张图片


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


End;



你可能感兴趣的:(nginx)