I seems that the proxy_cache_purge
directive is supported only in the commercial nginx version.
Is there an alternative way I could get a file/path/key out of the cache?
Below my sample proxy_pass
configuration with enabled caching:
...
# Configure proxy cache
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=demo:10m;
proxy_pass http://127.0.0.1:90$uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache demo;
# proxy_cache off;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid any 1m;
...
If you just need to force nginx to refresh cache, you could use
proxy_cache_bypass
. It will make nginx to fetch new data from backend and put them in cache.