Recall & Review
beginner
What is the purpose of the
expires directive in nginx?The
expires directive sets the caching time for responses, telling browsers how long to keep files before requesting them again.Click to reveal answer
beginner
How do you set a file to expire 1 hour after it is served using the
expires directive?Use
expires 1h; inside the location or server block to tell browsers to cache the file for 1 hour.Click to reveal answer
intermediate
What does
expires max; do in nginx?It sets the cache expiration to a very long time (about 10 years), effectively telling browsers to keep the file indefinitely.
Click to reveal answer
intermediate
How does the
expires directive affect HTTP headers?It modifies the
Expires and Cache-Control headers to control browser caching behavior.Click to reveal answer
advanced
Can the
expires directive use negative values? What happens if you use expires -1;?Yes, negative values are allowed.
expires -1; tells browsers not to cache the response and to revalidate it every time.Click to reveal answer
What does
expires 30d; mean in an nginx config?✗ Incorrect
expires 30d; tells browsers to cache the file for 30 days before requesting it again.
Which HTTP headers does the
expires directive modify?✗ Incorrect
The expires directive sets the Expires and Cache-Control headers to control caching.
What happens if you set
expires off; in nginx?✗ Incorrect
expires off; disables adding the Expires header, so caching is not controlled by nginx.
How would you tell nginx to set caching to 10 minutes?
✗ Incorrect
expires 10m; sets the cache time to 10 minutes.
What is the effect of
expires -1; in nginx?✗ Incorrect
expires -1; tells browsers not to cache and to check with the server every time.
Explain how the
expires directive controls browser caching in nginx.Think about how browsers know when to ask for a new file.
You got /5 concepts.
Describe a scenario where you would use
expires max; and why.Consider files that don’t change often and can be cached for a long time.
You got /4 concepts.