Logo

Armand.nz

Home / About / Linkedin / Github

NGINX Byte Range Caching

#nginx #caching |

Source: Smart and Efficient Byte-Range Caching with NGINX & NGINX Plus

# Byte Range caching  
# * [Byte range caching](https://www.nginx.com/blog/smart-efficient-byte-range-caching-nginx/ "https://www.nginx.com/blog/smart-efficient-byte-range-caching-nginx/")  
# * using the [slice](https://nginx.org/en/docs/http/ngx_http_slice_module.html "https://nginx.org/en/docs/http/ngx_http_slice_module.html") directive  
  
proxy_cache_path /tmp/mycache keys_zone=mycache:10m;  
  
location / {  
	slice 1m; # 1 MB fragments  
	proxy_cache mycache;  
    proxy_cache_key    $host$uri$is_args$args$slice_range;
	proxy_set_header Range $slice_range;  
	proxy_cache_valid 200 206 1h;  
	# etc..  
  
	proxy_pass http://backend;  
}
comments powered byDisqus

Copyright © Armand