有这种情况
set $static_root /home/....
set $folder ...
location @vincent {
proxy_pass http://vincent;
}
location ~* "/img/([a-z0-9\-]{2,5})/([a-z]{1,3})/([0-9]{1,2}\.jpg)" {
set $cache $static_root/cached/$folder/$1/$2/$3;
set $cache_common $static_root/cached/common/$1/$2/$3;
try_files $cache $cache_common @vincent;
#if (-f $cache) {
# return 301; break;
#
}
使用此配置,我有一个 @vincent 后备,但注释“if”有效,即如果我取消注释 if-block,我将获得 301 页面。这意味着缓存文件存在,但 try_files 不会提供它,为什么?