【问题标题】:Nginx is not caching the path I setup to cacheNginx 没有缓存我设置的缓存路径
【发布时间】:2021-10-04 17:27:45
【问题描述】:
proxy_cache_path /tmp/nginx_team_alert_cache keys_zone=team_alerts:10m levels=1:2 max_size=1g use_temp_path=off;

server{
...
    location /api/timeentry/timeentry/team_alerts/ {
        proxy_cache team_alerts;
        proxy_ignore_headers Cache-Control Set-Cookie;
        proxy_hide_header "Set-Cookie";
        proxy_cache_valid 200 5s;
        proxy_cache_key $scheme$host$request_method$request_uri;
        proxy_buffering on;
        add_header X-Cached $upstream_cache_status;

        include         uwsgi_params;
        uwsgi_pass      unix:/tmp/app.sock;
    }
}

我一直在搜索 stackoverflow 等并添加了所有推荐的选项,但仍然没有缓存。

【问题讨论】:

    标签: nginx caching


    【解决方案1】:

    我刚刚意识到我是uwsgi_pass,所以proxy_* 指令不起作用,只需将proxy_* 替换为uwsgi_* 就可以了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-03
      • 1970-01-01
      • 2017-04-05
      • 2021-04-29
      • 1970-01-01
      • 1970-01-01
      • 2018-03-04
      • 1970-01-01
      相关资源
      最近更新 更多