目前的反代配置如下:
proxy_cache_path /data/caches/xxx.com levels=1:2 keys_zone=gravatar:50m inactive=30m max_size=50m;
server {
listen 80;
server_name xxx.com;
charset utf-8,gbk;
location / {
proxy_pass http://cn.gravatar.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache gravatar;
proxy_cache_valid 200 304 301 7d;
proxy_cache_valid 500 502 503 504 0s;
proxy_cache_valid any 7d;
proxy_cache_min_uses 1;
expires 12h;
}
}
这样的配置是带有全局缓存的,假如我只希望 xxx.com/admin 这个路径不带有缓存,该如何配置?
1
Lax 2018-05-25 15:31:35 +08:00 1
再加一个 location
location /admin { proxy_pass ...; } |
2
hisys 2018-05-25 16:16:26 +08:00 1
在一楼基础上添加一行:
proxy_cache_valid any 0s; |