Searching Principle of Nginx Location Block

Nginx uses location block to set configuration on different request URI. With prefix and regular method. From priority high to low is =, ^~, ~ and ~*, none. Nginx first checks locations defined by the prefix strings. Then checks the regular expression in the order of their appearance. There is a mechanism to determine which location block is used.