location / {
proxy_cache my_cache;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_pass http://my_upstream;
}
如果是动态文件,不加“proxy_cache_valid 200 304 1h;”内容。哪么页面不缓存,如果加了这个内容,如果动态文件更新了。用户看到还是旧信息,如何即时更新。又可以在服务器宕机的时候时候让用户看到缓存页面。
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
这句话的意思是,如果后端服务器返回错误或者5xx等错误,给用户返回之前的cache数据吧。动态页面如何做呢