Problem with proxy_cache_path and limit

Maxim Dounin mdounin at
Tue Dec 19 18:10:27 UTC 2017


On Tue, Dec 19, 2017 at 12:48:41PM -0500, erick3k wrote:

> what i observe is the folder cachemaster going over 1gb, way over until it
> fills the hard drive.

Please define "until it fills the hard drive".  It is ok if you 
have only 1gb or 2gb free, but it is certainly not ok if it fills 
a free 200gb drive.

Additional question is about temporary files.  As previously 
explained, temporary files are not counted against the cache 
max_size limit, yet will occupy space in the same folder due to 
"use_temp_path=off".  Consider using "use_temp_path=on" (the 
default) with a proxy_temp_path pointing to a different folder to 
test if the space is occupied by the cache or temporary files.

You may also want to take a look into the error log, to see if 
there are any crit/alert/emerg errors.  Also you may want to 
check what the nginx cache manager process is doing.

> so what is the correct way to limit the cache size used by nginx?

The "proxy_cache_path ... max_size=..." is the correct way.  
Though it should be understood that it doesn't limit the size of 
the folder, but rather instruct nginx to remove old cache items if 
the size of the cache is above the limit.

Maxim Dounin

More information about the nginx mailing list