Nginx的fastcgi_cache_valid vs fastcgi_cache_path的不活动

如果我configuration

fastcgi_cache_path /opt/nginx levels=1:2 keys_zone=TEST:100m inactive=40m; .. fastcgi_ignore_headers Cache-Control Expires Set-Cookie; fastcgi_cache_valid 30m; 

我的caching存储在上面的path多久?

fastcgi_cache_valid用于为没有“X-Accel-Expires”,“Expires”或“Cache-Control”头的回复定义caching时间。
fastcgi_cache_path ... inactive=用于定义在不访问浏览器的情况下对象应该保存多长时间。

所以在你的情况下, fastcgi_cache_valid 30mfastcgi_cache_path ... inactive=40m从原始服务器没有任何caching控制标题的所有答复将有效30分钟(但可以使用30分钟后,如果原始服务器的问题,如果fastcgi_cache_use_stale是configuration)。
但是,如果40分钟内没有用户对该对象的请求,则高速caching的对象将从高速caching中删除。