是缓存配置问题,注释掉官方的配置,换成自己的。
列子
location / {
# 后端服务器地址
proxy_pass http://www.domain.com;
proxy_http_version 1.1;
# 以下为代理头设置
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 cache_one;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_lock on;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_background_update on;
# 不同文件类型的缓存时间设置
# HTML 页面及其他文件类型
proxy_cache_valid 200 304 301 302 120m;
# 其他缓存相关配置
proxy_ignore_headers Set-Cookie Cache-Control expires;
proxy_hide_header Set-Cookie;
# 在响应头中添加缓存状态信息
add_header X-Cache-Status $upstream_cache_status;
} |