Nginx cache filename

Daniel Biazus daniel.biazus at azion.com
Wed Jan 20 19:11:34 UTC 2016


You may use the md5 function in order to get the cache file on filesystem,
Ex:

If you use the cache key "$host$uri$is_args$args" and the cache base path
is /var/cache/nginx/ and cache has 2 levels (levels=1:2)

Considering the URL "http://example.com/static/test.png"

The cache file name will be
/var/cache/nginx/5/43/6e281642dfbf0b9ebf4cfb30142ab435

Based on:

echo -n 'example.com/static/test.png' | md5sum
6e281642dfbf0b9ebf4cfb30142ab435

First level = 5
Second level = 43
Filename = 6e281642dfbf0b9ebf4cfb30142ab435


Hope it helps

On Wed, Jan 20, 2016 at 6:05 AM, Tigran Bayburtsyan <
tigran.bayburtsyan at gmail.com> wrote:

> Hi All
>
> I’m doing centralized service for clearing our servers Nginx cache for
> specific files, but I can’t find the algorithm how Nginx making cache file
> based on request and cache_key.
>
> The only thing in documentation is
> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path
>
> How can I get cache file path for this static file
> http://example.com/static/test.png ?
>
>
>
> Thanks
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>



-- 

Daniel Biazus
infrastructure Engineering
Azion Technologies
Porto Alegre, Brasil +55 51 3012 3005 | +55 51 82279032
Miami, USA +1 305 704 8816

Quaisquer informações contidas neste e-mail e anexos podem ser
confidenciais e privilegiadas, protegidas por sigilo legal. Qualquer forma
de utilização deste documento depende de autorização do emissor, sujeito as
penalidades cabíveis.

Any information in this e-mail and attachments may be confidential and
privileged, protected by legal confidentiality. The use of this document
require authorization by the issuer, subject to penalties.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20160120/e8a2ae5a/attachment.html>


More information about the nginx-devel mailing list