Hello! I would like to know how to correctly cache content from CDN.
CDN contains a bunch of files (some very large, up to 200GB) I want to keep them in my cache so my friends can download from my server.
The problem is that I want to be sure that content will be downloaded from CDN only once, by nginx and all requests to my nginx will be served only from cache. I think that slices is what I need. I tried to configure nginx but seems it doesn't worked out. Smaller files are OK, but I have problems with bigger (50GB) files. Could you help me please
Here are parts of my config file:
http {
proxy_cache_path /data/nginx/cache keys_zone=mycache:100m levels=1:2 max_size=1000g inactive=7d;
server {
listen 81;
resolver 1.1.1.1;
location / {
limit_rate 30m;
proxy_pass http://cdnservice.tld$request_uri;
proxy_buffering on;
proxy_cache mycache;
slice 30m;
proxy_cache_key $host$uri$is_args$args$slice_range;
proxy_set_header Range $slice_range;
proxy_http_version 1.1;
proxy_ignore_headers Cache-Control;
proxy_hide_header ETag;
proxy_cache_valid 200 7d;
}
}
CDN contains a bunch of files (some very large, up to 200GB) I want to keep them in my cache so my friends can download from my server.
The problem is that I want to be sure that content will be downloaded from CDN only once, by nginx and all requests to my nginx will be served only from cache. I think that slices is what I need. I tried to configure nginx but seems it doesn't worked out. Smaller files are OK, but I have problems with bigger (50GB) files. Could you help me please
Here are parts of my config file:
http {
proxy_cache_path /data/nginx/cache keys_zone=mycache:100m levels=1:2 max_size=1000g inactive=7d;
server {
listen 81;
resolver 1.1.1.1;
location / {
limit_rate 30m;
proxy_pass http://cdnservice.tld$request_uri;
proxy_buffering on;
proxy_cache mycache;
slice 30m;
proxy_cache_key $host$uri$is_args$args$slice_range;
proxy_set_header Range $slice_range;
proxy_http_version 1.1;
proxy_ignore_headers Cache-Control;
proxy_hide_header ETag;
proxy_cache_valid 200 7d;
}
}