February 2018
Beginner to intermediate
348 pages
9h 40m
English
server {
server_name website.com;
location ^~ /doc {
[...] # requests beginning with "/doc"
}
location ~* ^/document$ {
[...] # requests exactly matching "/document"
}
}
This last case makes use of the ^~ modifier. Which block applies when a client visits http://website.com/document? The answer is the first block. The reason is that ^~ has priority over ~*. As a result, any request with a URI beginning with /doc will be affected to the first block, even if the request URI matches the regular expression defined in the second block.