0
0
Nginxdevops~10 mins

Purging cached content in Nginx - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to purge the cache for a specific URL using curl.

Nginx
curl -X [1] http://localhost/cache/purge/url
Drag options to blanks, or click blank then click option'
APURGE
BGET
CPOST
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET or POST instead of PURGE will not remove cached content.
Using DELETE is not supported by nginx cache purging.
2fill in blank
medium

Complete the nginx configuration line to enable cache purging for the location '/cache/purge/'.

Nginx
location /cache/purge/ {
    [1] on;
}
Drag options to blanks, or click blank then click option'
Aproxy_cache_purge
Bproxy_cache
Cproxy_cache_path
Dproxy_cache_valid
Attempts:
3 left
💡 Hint
Common Mistakes
Using proxy_cache_path instead of proxy_cache_purge disables purging.
proxy_cache_valid controls cache duration, not purging.
3fill in blank
hard

Fix the error in this nginx cache purge location block by completing the missing directive.

Nginx
location /purge/ {
    allow 127.0.0.1;
    deny all;
    [1] on;
}
Drag options to blanks, or click blank then click option'
Aproxy_cache_key
Bproxy_cache_path
Cproxy_cache_purge
Dproxy_cache_methods
Attempts:
3 left
💡 Hint
Common Mistakes
Using proxy_cache_path or proxy_cache_key will cause errors or no purging.
Forgetting to allow local IPs will block purge requests.
4fill in blank
hard

Fill both blanks to complete the nginx cache purge location that allows purging only from localhost and enables purging.

Nginx
location /cache/purge/ {
    [1] 127.0.0.1;
    [2] all;
    proxy_cache_purge on;
}
Drag options to blanks, or click blank then click option'
Aallow
Bdeny
Cproxy_cache
Dproxy_cache_path
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing allow and deny directives.
Using proxy_cache directives instead of allow/deny.
5fill in blank
hard

Fill all three blanks to complete a dictionary comprehension that maps URLs to their cache purge commands.

Nginx
purge_commands = [1]: f"curl -X [2] http://localhost[3]" for [1] in urls if urls[[1]] == 'cache'
Drag options to blanks, or click blank then click option'
Aurl
BPURGE
DGET
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET instead of PURGE will not purge cache.
Using different variable names inconsistently.