location=/{# matches the query / only.
### [ configuration A ] ###
}location/{# matches any query, since all queries begin with /, but regular
# expressions and any longer conventional blocks will be
# matched first.
### [ configuration B ] ###
}location/documents/{# matches any query beginning with /documents/ and continues searching,
# so regular expressions will be checked. This will be matched only if
# regular expressions don't find a match.
### [ configuration C ] ###
}location^~/images/{# matches any query beginning with /images/ and halts searching,
# so regular expressions will not be checked.
### [ configuration D ] ###
}location~*\.(gif|jpg|jpeg)$ {# matches any request ending in gif, jpg, or jpeg. However, all
# requests to the /images/ directory will be handled by
# Configuration D.
### [ configuration E ] ###
}
A:Location: /
Match type: exact
B:Location: /
Match type: prefix
C:Location: /example/
Match type: prefix
D:Location: /example/important
Match type: forward match (或 priority prefix)
E:Location: \.(ex1|ex2|ex3)$
Match type: case insensitive regex
/ : A
/test/path : B
/example/page : C
/example/important : D
/file.ex1 : E
/example_a/my/resources : B
/example_a : B
/test/.ex2 : E
/example/page/extra : C
/example/important/data : D
/file.ex4 : B
/default : B
/example_a/some/file.ex2 : E
/some/random/path : B
/test/ex1 : E
/example/important/file : D
/file.EX2 : E
/example_a/important/file : B
/example/some/file.ex3 : E
/example/important/extra/file.ex2 : D