首页 > 解决方案 > 缓存 NGINX 代理返回 MISS

问题描述

我目前有以下配置:

proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:180m inactive=60m max_size=700m;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;

...

server_name example.com
location / {
    proxy_cache my_zone;
    proxy_cache_key "$scheme://$host$uri";
    proxy_cache_valid 200 301 302 100d;
    proxy_cache_bypass  $http_cache_control;
    proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;
    add_header X-Proxy-Cache $upstream_cache_status;

    include proxy_params;
    proxy_pass http://127.0.0.1:8000;
}

但是在访问服务器时,我似乎总是得到x-proxy-cache: MISS

$ curl -I https://example.com

怎么来的?

标签: nginxcaching

解决方案


推荐阅读