Complete the code to set the cache validity time to 10 minutes.
proxy_cache_valid 200 [1];
The directive proxy_cache_valid sets how long responses with status 200 are cached. Here, 10 minutes is the correct duration.
Complete the code to cache responses with status 404 for 1 minute.
proxy_cache_valid [1] 1m;
The proxy_cache_valid directive can specify different cache times for different HTTP status codes. Here, 404 means 'Not Found' responses are cached for 1 minute.
Fix the error in the cache validity rule to cache all responses for 5 minutes.
proxy_cache_valid [1] 5m;
The correct keyword to cache all response statuses in nginx is any. Other options are invalid and cause errors.
Fill both blanks to cache 301 and 302 responses for 30 minutes.
proxy_cache_valid [1] 30m; proxy_cache_valid [2] 30m;
301 and 302 are HTTP redirect status codes. Setting cache validity for both to 30 minutes helps cache redirects properly.
Fill all three blanks to cache 200 responses for 15 minutes, 404 for 5 minutes, and any other status for 1 minute.
proxy_cache_valid [1] 15m; proxy_cache_valid [2] 5m; proxy_cache_valid [3] 1m;
This configuration sets different cache times for successful responses (200), not found errors (404), and all other statuses (any).