March 22, 2017 06:54PM
Results of queries for the same URL using different settings for proxy_cache_path "levels"

# levels not specified, so all cache files reside in a single directory
proxy_cache_path /data/nginx/cache;
/data/nginx/cache/d7b6e5978e3f042f52e875005925e51b

# a lot of config examples use levels=1:2 - this provides 16 x 256 = 4096 directories in 2 levels
proxy_cache_path /data/nginx/cache levels=1:2;
/data/nginx/cache/b/51/d7b6e5978e3f042f52e875005925e51b

# levels=1:1:1 also provides 16^3 = 4096 directories, but in 3 levels
proxy_cache_path /data/nginx/cache levels=1:1:1;
/data/nginx/cache/b/1/5/d7b6e5978e3f042f52e87500592

# levels=2:2:2 provides the maximum possible number of directories 256^3 = ~16 million
proxy_cache_path /data/nginx/cache levels=2:2:2;
/data/nginx/cache/1b/e5/25/d7b6e5978e3f042f52e875005925e51b


# levels=2
proxy_cache_path /data/nginx/cache levels=2;
/data/nginx/cache/1b/d7b6e5978e3f042f52e875005925e51b


levels= instructs Nginx to create subdirectories within proxy_cache_path
You can specify up to 3 colon-separated digits to create up to 3 levels of subdirectory.
The colon-separated digits can be either "1" or "2" to define if that level should contain 16 (0-f) or 256 (00-ff) subdirectories.
These directory names are a single- double-place hexidecimal value (0-f or 00-ff).

Cache files reside in directories that correspond to the last few hex values of the file name.
Subject Author Posted

proxy_cache_path levels

nfn May 28, 2009 06:21AM

Re: proxy_cache_path levels

Igor Sysoev May 28, 2009 06:50AM

Re: proxy_cache_path levels

yolabingo March 22, 2017 06:54PM

Re: proxy_cache_path levels

yolabingo March 22, 2017 08:44PM

Re: proxy_cache_path levels

nfn May 28, 2009 02:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready