我有两个坐骑:
在 nginx 中我配置了一个位置,如下所示:
location ~ /my_location/(.*) {
alias /mnt/;
try_files ssd/$1 nfs/$1 =404;
}
Run Code Online (Sandbox Code Playgroud)
这本身就很好用。
我想记录何时从 ssd 找到文件以及何时需要从 nfs 挂载获取该文件。
从SSD查找文件将被记录为HIT。
必须转到nfs将被记录为MISS。
我怎样才能实现这个目标?
我刚刚想出的一种可能的解决方案,使用额外的命名位置:
location /my_location/ {
alias /mnt/ssd/;
set $file_source ssd;
try_files $uri @nfs;
}
location @nfs {
alias /mnt/nfs/;
set $file_source nfs;
try_files $uri =404;
}
Run Code Online (Sandbox Code Playgroud)
现在您知道如何处理这个新变量了。
归档时间: |
|
查看次数: |
758 次 |
最近记录: |