nginx "proxy_cache" zone … is unknown
Fix nginx "proxy_cache" zone is unknown by matching the name to keys_zone in proxy_cache_path and checking that nginx reads the declaration file.
2026/11/28 21:29:30 [emerg] 1#1: "proxy_cache" zone "demo" is unknown in /repro/nginx.conf:11nginx: [emerg] "proxy_cache" zone "demo" is unknown in /repro/nginx.conf:11nginx: configuration file /repro/nginx.conf test failednginx cannot find the shared memory zone named in a literal proxy_cache value. Take the name in quotes, demo here, and match it to keys_zone in the deployed configuration. nginx 1.28.0 checks for the zone when it merges proxy settings. In this example the error points to line 11, while proxy_cache demo; is on line 7. Zone check in nginx 1.28.0
[1] Run nginx -t against the configuration the service will read. In a container deployment, test with the same image and mounts. If the service uses -c to select the config file or -p to set the path prefix, use those options in the test too. This is the command run inside the test container. nginx command-line options
$ nginx -t -c /repro/nginx.confThe failed test produced the output above and exited with status 1. When looking for the reference, search for the zone name in quotes as well as checking the reported line. If the error is invalid URL prefix, check the scheme in the proxy_pass URL.
[2] Match the reference to a declaration in the main config and its includes. The commands below use the test paths. In production, use the paths from your own include directives. Check that each filename matches the include pattern. If a declaration spans several lines, read through the semicolon to find keys_zone. nginx include directive
$ grep -nE '^[[:space:]]*(include|proxy_cache|proxy_cache_path)[[:space:]]' /repro/nginx.conf$ grep -RnE '^[[:space:]]*(include|proxy_cache|proxy_cache_path)[[:space:]]' /repro/zones| What you find | What to check |
|---|---|
proxy_cache demo; with keys_zone=other:1m | Check which name the deployment is supposed to use. |
The declaration exists in a file outside include /repro/zones/*.conf; | Check that the packaged file is mounted at the expected location and its extension matches the pattern. |
The proxy_cache value contains a variable | nginx handles variable values through a separate code path. The config-test error reproduced here uses a literal name. |
The test produced the same error when the declared name was other and when the include pattern matched no files. Running nginx -T against the mismatched config also failed and printed no config dump. Search the files directly while the test fails. Literal names and variable values in the source
[3] Restore the zone the reference is meant to use. Keep a copy of the configuration before editing. If the existing keys_zone name is correct, update proxy_cache. If the declaration file is missing, restore it to a location included from the http block. Check every server or location that references an existing zone before renaming it. In the test the http block loaded this file. Keep the disk path and zone size from your deployment. proxy_cache and proxy_cache_path
proxy_cache_path /var/cache/nginx/demo keys_zone=demo:1m;The name is demo, the part before the colon. The zone has 1m of shared memory, and nginx stores cache files under /var/cache/nginx/demo. The test passed with the declaration included after proxy_cache demo;.
[4] Repeat the test with the same options. Check for both lines below and exit status 0. To apply the change to a running service, use your deployment's reload procedure after the test passes.
$ nginx -t -c /repro/nginx.confnginx: the configuration file /repro/nginx.conf syntax is oknginx: configuration file /repro/nginx.conf test is successfulAfter the test passes, nginx -T can show which declaration file nginx loaded. It prints the full configuration, so review it before sharing. To roll back an applied change, restore the saved files or the last working deployment, run the same test, and reload after it passes. Reloading nginx configuration
Analyze your Nginx log in the browser ↗ — nothing is uploaded.