1 关于location的写法
syntax: location [=|~|~*|^~] /uri/ { … }
2多个location执行顺序
The order you established in the configuration file (placing the /files/ block before
the = /files/ block) is irrelevant. Nginx will search for matching patterns in a
specific order:
1. location blocks with the = modifier: If the specified string exactly matches
the requested URI, Nginx retains the location block
2. location blocks with no modifier: If the specified string exactly matches the
requested URI, Nginx retains the location block
3. location blocks with the ^~ modifier: If the specified string matches the
beginning of the requested URI, Nginx retains the location block
4. location blocks with ~ or ~* modifier: If the regular expression matches the
requested URI, Nginx retains the location block
5. location blocks with no modifier: If the specified string matches the
beginning of the requested URI, Nginx retains the location block
In that extent, the ^~ modifier begins to make sense, and we can envision cases
where it becomes useful.
参考文档:
1 book - Nignx http server chapter: Location --search order and priority
2 http://blog.rackcorp.com/?p=31
3 http://flandycheng.blog.51cto.com/855176/280121
上面2,3链接,都是延伸,有助于在1的基础上,基于实例,更深的了解。