Purging cached content means removing stored copies of web pages or files from nginx's cache so that fresh content is fetched from the original source.
Click to reveal answer
intermediate
Which nginx module is commonly used to enable cache purging?
The ngx_cache_purge module allows selective removal of cached content in nginx.
Click to reveal answer
beginner
What is a simple method to purge all cached content in nginx?
You can delete the cache directory files manually and then reload nginx to clear all cached content.
Click to reveal answer
intermediate
How can you configure nginx to allow HTTP requests to purge cache?
By adding a location block with the 'proxy_cache_purge' directive and securing it with access controls, nginx can accept purge requests via HTTP methods like PURGE or DELETE.
Click to reveal answer
beginner
Why is it important to secure cache purge requests in nginx?
Because allowing anyone to purge cache can cause performance issues and unwanted content refreshes, so access should be restricted to trusted users or IPs.
Click to reveal answer
What happens when you purge cached content in nginx?
Anginx stops serving any content
Bnginx restarts automatically
Cnginx cache size increases
DCached files are deleted so fresh content is fetched
✗ Incorrect
Purging removes cached files so nginx fetches fresh content from the origin.
Which HTTP method is commonly used to send a cache purge request in nginx?
AGET
BPOST
CPURGE
DPUT
✗ Incorrect
The PURGE method is often used to request cache removal in nginx.
What is a safe practice when enabling cache purging in nginx?
But PURGE requests still return 403 Forbidden. What is the likely cause?
medium
A. Cache is empty so purge fails
B. proxy_cache_purge directive is misspelled
C. Missing allow/deny rules to permit purge requests
D. PURGE method is not supported by nginx
Solution
Step 1: Understand default access control
Without 'allow', nginx denies all due to 'deny all;' for security.
Step 2: Check purge access rules
To allow PURGE requests, you must explicitly allow trusted IPs.
Final Answer:
Missing allow/deny rules to permit purge requests -> Option C
Quick Check:
deny all without allow = 403 Forbidden on PURGE [OK]
Hint: Always add allow/deny for purge locations [OK]
Common Mistakes:
Assuming PURGE method is unsupported
Ignoring access control rules
Thinking empty cache causes 403
5. You want to purge cached content only for URLs starting with /images/ and restrict purge access to IP 10.0.0.5. Which nginx config snippet correctly achieves this?