我们有两个具有独立本地缓存的 Nginx 服务器,用于缓存图像。缓存大小的非托管增长会定期出现问题。此大小可能远远大于max_size
在nginx.conf
。结果缓存占用了所有可用磁盘空间。
我想了解这个问题的原因可能是什么。
代理缓存配置 ( nginx.conf
):
proxy_cache_path /opt2/nginx-cache-images1 max_size=150g levels=2:2 keys_zone=images1:1024m inactive=24h;
proxy_temp_path /opt2/proxy_temp 1 2;
Run Code Online (Sandbox Code Playgroud)
大小/opt2/nginx-cache-images1
约为 200GB。
站点位置配置:
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Is-Referer-Search-Engine $is_referer_search_engine;
proxy_hide_header Set-Cookie;
proxy_hide_header Content-Disposition;
proxy_pass http://ua-image-proxy;
default_type image/jpeg;
proxy_cache images1;
proxy_cache_key ua$request_uri$is_referer_search_engine;
proxy_cache_valid 200 24h;
proxy_cache_valid 301 24h;
proxy_cache_valid 404 1h;
}
Run Code Online (Sandbox Code Playgroud)
Nginx 版本:1.7.7 和 1.7.9。它是在 Ubuntu 14.04 上编译的。
归档时间: |
|
查看次数: |
1047 次 |
最近记录: |