Answer the question
In order to leave comments, you need to log in
How does proxy_cache_lock work in nginx?
Hello!
I'm trying to set up caching on nginx, it is necessary that if the cache is missing or updated , one request is sent to the backend, for this, as I understand it, you need to use the proxy_cache_lock directive, but if there is no cache, initially with a large number of requests, they are not blocked but go to the backend. What have I done wrong ?
proxy_cache_valid 200 1m;
proxy_cache_use_stale updating;
proxy_cache_background_update on;
proxy_cache_lock on;
proxy_cache_path /var/local/nginx/cache levels=1:2 inactive=12h keys_zone=cache:10m max_size=500m use_temp_path=off;
proxy_cache_key $http_host$request_uri;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question