proxy_store doesn't create directories

Phil Endecott nginx_list at
Tue Feb 16 15:48:49 UTC 2021

Phil Endecott wrote:
> I have just tried to use proxy_store for the first time and
> it seems to almost work, but it looks like it does not create
> the parent directories for the things that it needs to save.

OK, I've got this working now.

My aim is for a request to http://server.local/ 
to be fetched from and stored in 

My config is now:

location / {
        root /var/cache/nginx/;
        error_page 404 = /fetch$uri;
location ~^/fetch/(.*)$ {
        proxy_pass http://$1;
        proxy_store on;
        proxy_store_access user:rw group:r all:r;
        alias /var/cache/nginx/$1;

My mistake before was that I omitted the $1 from the alias line.
(Is there a simpler way to do this?)

Thanks Francis for your reply.


More information about the nginx mailing list