HTTP proxy directives

proxy_cache_path directive

HTTP context; declares cache storage and shared metadata zone. No default path declaration. Size target is managed rather than a hard quota.

Formal Syntax & Structure

nginx syntaxnginx
proxy_cache_path path [levels=levels] [use_temp_path=on|off] keys_zone=name:size [inactive=time] [max_size=size] [min_free=size] [manager_files=number] [manager_sleep=time] [manager_threshold=time] [loader_files=number] [loader_sleep=time] [loader_threshold=time] [purger=on|off] [purger_files=number] [purger_sleep=time] [purger_threshold=time];

Parameters & Attributes

NameTypeDescription
pathdirectoryLab-owned storage directory for cached response files.
keys_zonename:sizeShared memory name and capacity for cache metadata, not response bodies.
levelscolon-separated integersOptional directory fan-out: one to three levels, each one or two characters.
use_temp_pathon | offWhether to use configured temporary directory rather than the cache directory.
inactivedurationRemove entries not accessed during this interval, even if fresh.
max_sizebyte sizeManaged disk usage target, not a hard quota.
min_freebyte sizeManaged free-space target (1.19.1 or later).
manager_filesintegerLimit files processed per manager iteration.
manager_sleepdurationPause between manager iterations.
manager_thresholddurationTime budget per manager iteration.
loader_filesintegerLimit files processed per loader iteration.
loader_sleepdurationPause between loader iterations.
loader_thresholddurationTime budget per loader iteration.
purgeron | offCommercial cache purger switch; verify edition.
purger_filesintegerCommercial purger iteration file limit.
purger_sleepdurationCommercial purger iteration pause.
purger_thresholddurationCommercial purger iteration time budget.

Working Example

Example Snippetnginx
proxy_cache_path cache keys_zone=public_docs:1m max_size=16m inactive=5m;
Nginx Reference