Skip to content

Instantly share code, notes, and snippets.

@uggedal
Created May 28, 2013 17:28
Show Gist options
  • Save uggedal/5664489 to your computer and use it in GitHub Desktop.
Save uggedal/5664489 to your computer and use it in GitHub Desktop.
Multiple location match in nginx
location ~ ^/(.*)/(.*)/other/stuff/(.*)/this-is-static {
location /static-cache {
# root/alias or other config here
}
try_files /static-cache/$1/$2/$3/this-is-static @app;
}
# or
location ~ ^/(.*)/(.*)/other/stuff/(.*)/this-is-static {
# if you use static-cache in other location blocks and/or the root scope:
include static-cache.conf;
try_files /static-cache/$1/$2/$3/this-is-static @app;
}
@cjohansen
Copy link

Oh, scratch that, I missed out on the ~ part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment