K
K
Konstantin Khairov2019-08-26 14:40:49
Nginx
Konstantin Khairov, 2019-08-26 14:40:49

Why is nginx caching not working?

Hello everyone, I installed an SSD, I want to cache video there to relieve the load from the HDD. added proxy_cache_path /media/ssd_cache/cached inactive=12h levels=1:2:2 keys_zone=local_cache:50m max_size=50g
in config in http{} section ; in the location specified the name of the cache, etc., but the files are not cached, no cache files appear in the specified folder, for example, and the load on the disk is growing

Location with all options

location ~* /video/hdd_([1-8])/(.*).mp4$ {
proxy_cache local_cache;
proxy_cache_key $2;
proxy_cache_min_uses 0;
proxy_cache_valid 12h;
proxy_ignore_headers Set-Cookie;
#error_page 503 /raboti.mp4
mp4;
mp4_buffer_size 2M; #2
mp4_max_buffer_size 6M; #4
access_log off;
expires max;
#limit_speed one 10204k;
#limit_conn addr 6;
aio threads;
#directio 512; #512
#output_buffers 1 6m; #1m
sendfile on;
sendfile_max_chunk 256k;
tcp_nopush on;
tcp_nodelay on;
gzip off;
gzip_static off;
open_file_cache max=20000;
#add_header Cache-Control public;

Why doesn’t NGINX want to start caching into this in any way?, I’m sorry, this is the first time I’ve done this and have already spent a couple of hours looking for an answer to my problem, but I didn’t even find anything close ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2019-08-26
@dimonchik2013

has it all gone?

L
Lynn "Coffee Man", 2019-08-26
@Lynn

Well, why would he cache something?
proxy_cacheonly works for proxy_pass, but here it is not. And for local files, the developers reasonably decided that you yourself can shift them where necessary.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question