Scenario: http download mirror for Yocto project. Each product has own download subdirectory, but some downloads can be reused, so make one http endpoint which search through all subdirectories.
location = /downloads/ {
root /srv;
autoindex on;
}
location ~ ^/downloads/.*/$ {
root /srv;
autoindex on;
}
location ~ ^/downloads/(.*)$ {
root /srv/downloads;
try_files /astra/$1
/genio/$1
/mediatek/$1
/synaptic/$1
=404;
autoindex on;
}