0
0
Nginxdevops~20 mins

Why caching improves response times in Nginx - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Caching Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does caching reduce server load?

Which of the following best explains how caching reduces the load on a web server?

ACaching stores copies of responses so repeated requests can be served without processing again.
BCaching increases the number of requests the server must handle by duplicating data.
CCaching deletes old files to free up server space, reducing load.
DCaching forces the server to recompile code for every request to improve speed.
Attempts:
2 left
💡 Hint

Think about how serving stored data affects the work the server does.

💻 Command Output
intermediate
1:30remaining
Nginx cache status header output

What is the output of the X-Cache-Status header when Nginx serves a cached response?

Nginx
curl -I http://example.com/resource
AX-Cache-Status: ERROR
BX-Cache-Status: MISS
CX-Cache-Status: HIT
DX-Cache-Status: BYPASS
Attempts:
2 left
💡 Hint

When a cached response is served, the status indicates a successful cache hit.

Configuration
advanced
2:30remaining
Correct Nginx cache configuration snippet

Which Nginx configuration snippet correctly enables caching for static files with a 1-hour cache duration?

A
location /static/ {
  proxy_cache my_cache;
  proxy_cache_valid 200 1h;
  proxy_pass http://backend;
}
B
location /static/ {
  proxy_cache my_cache;
  proxy_cache_valid 1h 200;
  proxy_pass http://backend;
}
C
location /static/ {
  proxy_cache my_cache
  proxy_cache_valid 200 1h
  proxy_pass http://backend
}
D
location /static/ {
  proxy_cache my_cache;
  proxy_cache_valid 404 1h;
  proxy_pass http://backend;
}
Attempts:
2 left
💡 Hint

Check the order and syntax of proxy_cache_valid directive.

Troubleshoot
advanced
2:00remaining
Why is Nginx not caching responses?

You configured Nginx caching but notice no cached responses are served. Which reason below explains this behavior?

AThe <code>proxy_cache_path</code> directive is missing or incorrectly set.
BThe backend server is sending <code>Cache-Control: no-cache</code> headers.
CThe <code>proxy_cache_valid</code> directive is set to 0 seconds.
DAll of the above.
Attempts:
2 left
💡 Hint

Consider all configuration and response header factors that affect caching.

🔀 Workflow
expert
3:00remaining
Order of steps to enable caching in Nginx

Put the steps in the correct order to enable caching of HTTP responses in Nginx.

A1,3,2,4
B1,2,3,4
C2,1,3,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about defining cache storage before using it in location blocks.