Skip to content

Instantly share code, notes, and snippets.

@zzzcpan
Created July 20, 2012 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzzcpan/3153263 to your computer and use it in GitHub Desktop.
Save zzzcpan/3153263 to your computer and use it in GitHub Desktop.
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment