I would like to see which objects get cached by my nginx reverse proxy (with an apache as a backend). So far I could not find a way, only the info that its not implemented yet.

The reason is that I would like to tweak my configuration for best performance without putting too much stress on the server, as the backend is a production system. I know benchmarking would be better, but its not an option right now. So I though an alternative measure would be to monitor the cache.

Is that possible, and if yes, how? (despite patching nginx with the patch mentioned in the link above)

3 Answers 3


Nginx saves the cached files at the Proxy_cache_path folder. The files are named by the md5 ooutput of the proxy url.

Please note that nginx saves the proxy header on the cached file. So it might be hard to check pictures.


  • I finally found the folders in my proxy_cache_path growing, so I have an idea of the amount of data that is cached. But for finer tuning it would be interesting of have a log or debug option.
    – Isaac
    Jun 12, 2012 at 12:11
  • Nginx saves the cached files at the proxy_cache_path folder.
  • The files are named after the md5 output of the proxy_cache_key (rather than the md5 output of the proxy url).

You can actually easily verify that by yourself: just open one of the files in your proxy_cache_path folder and run md5sum on the key:

$ cat /var/cache/nginx/d/be/54a355887f2e4391a6e0cb9150ae3bed
KEY: https://test/style.css
HTTP/1.0 200 OK
Strict-Transport-Security: max-age=31536000; includeSubDomains
$ echo -n https://test/style.css | md5sum
54a355887f2e4391a6e0cb9150ae3bed  -

Maybe slightly related. To see how many entries are in the cache zone, check how many entries are saved in the cache path (/tmp/nginx_cache in my example).

nginx@nginx-5d468f984d-trj8s:/tmp/nginx_cache$ find . -type f  | wc -l

This shows 18719 entries saved in the zone (upper bound, that some could be stale or old).

The path for the cache zone is determine by the directive configuring the cache. See for example the nginx caching guide.

  • it was not asked how many files are located at a specific location. the question was if its possible to find a specific picture imho
    – djdomi
    Jun 10, 2022 at 17:38
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 10, 2022 at 17:38
  • @djdomi yes it is not a full answer to the question, rather slightly related (I wrote it too). OP also asked about ways to monitor the cache and checking how many entries (upper bound) are there is one possible factor that one could monitor.
    – Pier A
    Jun 13, 2022 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .