You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/nginx/admin-guide/content-cache/content-caching.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ When caching is enabled, F5 NGINX Plus saves responses in a disk cache and uses
17
17
To learn more about NGINX Plus’s caching capabilities, watch the [Content Caching with NGINX](https://nginx.com/resources/webinars/content-caching-nginx-plus/) webinar on demand and get an in‑depth review of features such as dynamic [content caching](https://nginx.com/products/nginx/caching/), cache purging, and delayed caching.
18
18
19
19
<spanid="enable"></span>
20
-
## Enabling the Caching of Responses
20
+
## Enable the Caching of Responses
21
21
22
22
To enable caching, include the [`proxy_cache_path`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path) directive in the top‑level `http {}` context. The mandatory first parameter is the local filesystem path for cached content, and the mandatory `keys_zone` parameter defines the name and size of the shared memory zone that is used to store metadata about cached items:
23
23
@@ -65,7 +65,7 @@ proxy_cache_path /data/nginx/cache keys_zone=mycache:10m loader_threshold=300 lo
65
65
```
66
66
67
67
<spanid="select"></span>
68
-
## Specifying Which Requests to Cache
68
+
## Specify Which Requests to Cache
69
69
70
70
By default, NGINX Plus caches all responses to requests made with the HTTP `GET` and `HEAD` methods the first time such responses are received from a proxied server. As the key (identifier) for a request, NGINX Plus uses the request string. If a request has the same key as a cached response, NGINX Plus sends the cached response to the client. You can include various directives in the `http {}`, `server {}`, or `location {}` context to control which responses are cached.
71
71
@@ -88,7 +88,7 @@ proxy_cache_methods GET HEAD POST;
88
88
```
89
89
90
90
<spanid="bypass"></span>
91
-
## Limiting or Disabling Caching
91
+
## Limit or Disable Caching
92
92
93
93
By default, responses remain in the cache indefinitely. They are removed only when the cache exceeds the maximum configured size, and then in order by length of time since they were last requested. You can set how long cached responses are considered valid, or even whether they are used at all, by including directives in the `http {}`, `server {}`, or `location {}` context:
NGINX makes it possible to remove outdated cached files from the cache. This is necessary for removing outdated cached content to prevent serving old and new versions of web pages at the same time. The cache is purged upon receiving a special “purge” request that contains either a custom HTTP header, or the HTTP `PURGE` method.
124
124
125
125
<spanid="purge_configure"></span>
126
-
### Configuring Cache Purge
126
+
### Configure Cache Purge
127
127
128
128
Let’s set up a configuration that identifies requests that use the HTTP `PURGE` method and deletes matching URLs.
129
129
@@ -156,7 +156,7 @@ Let’s set up a configuration that identifies requests that use the HTTP `PURGE
156
156
```
157
157
158
158
<span id="purge_request"></span>
159
-
### Sending the Purge Command
159
+
### Send the Purge Command
160
160
161
161
When the `proxy_cache_purge` directive is configured, you need to send a special cache‑purge request to purge the cache. You can issue purge requests using a range of tools, including the `curl` command as in this example:
162
162
@@ -171,7 +171,7 @@ Connection: keep-alive
171
171
In the example, the resources that have a common URL part (specified by the asterisk wildcard) are purged. However, such cache entries are not removed completely from the cache: they remain on disk until they are deleted for either inactivity (as determined by the `inactive` parameter to the [`proxy_cache_path`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path) directive) or by the cache purger (enabled with the [`purger`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#purger) parameter to `proxy_cache_path`), or a client attempts to access them.
172
172
173
173
<spanid="purge_secure"></span>
174
-
### Restricting Access to the Purge Command
174
+
### Restrict Access to the Purge Command
175
175
176
176
We recommend that you limit the number of IP addresses that are allowed to send a cache‑purge request:
In this example, NGINX checks if the `PURGE` method is used in a request, and, if so, analyzes the client IP address. If the IP address is whitelisted, then the `$purge_method` is set to `$purge_allowed`: `1` permits purging, and `0` denies it.
192
192
193
193
<spanid="purge_remove"></span>
194
-
### Completely Removing Files from the Cache
194
+
### Completely Remove Files from the Cache
195
195
196
196
To completely remove cache files that match an asterisk, activate a special `cache purger` process that permanently iterates through all cache entries and deletes the entries that match the wildcard key. Include the [`purger`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#purger) parameter to the [`proxy_cache_path`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path) directive in the `http {}` context:
0 commit comments