Nginx 配置。带检查的磁盘文件
Nginx config. File from disk with check
我不明白如何编写逻辑:如果文件夹中的文件存在,则 return;
location ~ "/((\w{2})[\w-]+\.(png|jpg))$" {
if(-f e:\ThumbFull\\){
alias e:\ThumbFull\\;
}
if(-f e:\Image\\){
alias e:\Image\\;
}
return 404;
}
您可以将 root
设置为公共父目录(即 e:/
)并使用 try_files
检查两个目录中的文件。
例如:
location ~ "/((\w{2})[\w-]+\.(png|jpg))$" {
root e:/;
try_files /ThumbFull// /Image// =404;
}
详情见this document。
我不明白如何编写逻辑:如果文件夹中的文件存在,则 return;
location ~ "/((\w{2})[\w-]+\.(png|jpg))$" {
if(-f e:\ThumbFull\\){
alias e:\ThumbFull\\;
}
if(-f e:\Image\\){
alias e:\Image\\;
}
return 404;
}
您可以将 root
设置为公共父目录(即 e:/
)并使用 try_files
检查两个目录中的文件。
例如:
location ~ "/((\w{2})[\w-]+\.(png|jpg))$" {
root e:/;
try_files /ThumbFull// /Image// =404;
}
详情见this document。