Is it possible in nginx to do something that is the equivalent of a file path glob in try_files?

server {
  try_files /var/www/*/assets/$uri;

That is, if /var/www/ contained site_a and site_b, which both contained an assets directory, this would perform the equivalent of

server {
  try_files /var/www/site_a/assets/$uri /var/www/site_b/assets/$uri;

I'm trying to see if this is possible without having to reference the directories currently residing in /var/www.

Any suggestions welcome.

  • Not with default modules. If you have a few paths, just list them all. If there is a lot of paths, write script to generate node config.
    – Alexey Ten
    Jul 7 '14 at 12:43
  • Thanks, @AlexeyTen. I was leaning in that direction, but wanted to be sure.
    – Aupajo
    Aug 3 '14 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.