如何清除 nginx 代理缓存?

如何清除 nginx 代理缓存?

这是我的 nginx 配置:

proxy_cache_path  /tmp/nginxcache  levels=1:2  keys_zone=trycatchchris:10m max_size=1g inactive=1440m use_temp_path=off;

server {
    listen 3000;

    server_name trycatchchris.co.uk;
    root /var/www/html/public/;

    location / {
        proxy_pass http://localhost:3001/;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_cache trycatchchris;
        proxy_ignore_headers Cache-Control;
        proxy_cache_valid any 1440m;

        proxy_no_cache $cookie_nocache $arg_nocache;
        proxy_cache_bypass $cookie_nocache $arg_nocache;
        add_header X-Proxy-Cache $upstream_cache_status;
    }
}

如何清除缓存?

我已经看过了如何清除 nginx 缓存https://stackoverflow.com/questions/6236078/how-to-clear-the-cache-of-nginx(一个指向另一个)然而有许多答案,并且问题/接受的答案与历史错误有关 - 所以并不是一个很好的参考。

答案1

https://stackoverflow.com/a/6896903/1663462

就我而言:

find /tmp/nginxcache -type f -delete

相关内容