Created
May 28, 2013 17:28
-
-
Save uggedal/5664489 to your computer and use it in GitHub Desktop.
Multiple location match in nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
I tried this, except with the location /static-cache
part outside. Didn't work :/
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
This does not work at all since the inner location needs to be a more specific variant of the outer location.