Welcome! Log In Create A New Profile

Advanced

RE: Add files to cache manually

Reinis Rozitis
May 21, 2021 07:58AM
> One option is to keep a copy of the file on disk (outside of the nginx
cache). Then use something like try_files to read it, and have that response
be cached by nginx. But then I end up with 2 of the files on disk (one in my
try_files directory, and one in the nginx cache). I also need to manually
manage the files stored in my try_files directory (to delete them after they
enter the nginx cache). This is kind of ugly.

Is there a reason why you need nginx "cache" instead of just storing the
files statically?
One way would be instead of using the cache just store the files as is (in
the same structure) with proxy_store
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_store (there
is even a small configuration example).

The only drawback in this is that you have to manage the cache directory
yourself (delete old files / implement LRU if needed etc), but that's
usually not too hard with `find` and works just fine.

rr

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Add files to cache manually

foobug May 20, 2021 02:42PM

RE: Add files to cache manually

Reinis Rozitis May 21, 2021 07:58AM

Re: RE: Add files to cache manually

foobug May 21, 2021 12:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 296
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