perl_set $dice 'sub { if (@pool) { push @pool, shift @pool; } else { @pool = ("/test1", "/test2"); } my $r = shift; my $root = $r->variable("document_root"); my $uri = $r->uri; foreach my $path (@pool) { if (-f "$root/$path$uri") { return "$path$uri"; } } return ""; }'; server { location / { try_files $dice =404; } }