proxy_store doesn't create directories

Phil Endecott nginx_list at chezphil.org
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/remote.com/path/file 
to be fetched from http://remote.com/path/file and stored in 
/var/cache/nginx/remote.com/path/file.

My config is now:

location /remote.com/ {
        root /var/cache/nginx/;
        error_page 404 = /fetch$uri;
}
location ~^/fetch/(.*)$ {
        internal;
        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.

Phil.




More information about the nginx mailing list