A location can either be defined by a prefix string, or by a regular expression. Regular expressions are specified with the preceding “ *” modifier (for case-insensitive matching), or the “” modifier (for case-sensitive matching). To find location matching a given request, nginx first checks locations defined using the prefix strings (prefix locations). Among them, the location with the longest matching prefix is selected and remembered. Then regular expressions are checked, in the order of their appearance in the configuration file. The search of regular expressions terminates on the first match, and the corresponding configuration is used. If no match with a regular expression is found then the configuration of the prefix location remembered earlier is used. location blocks can be nested, with some exceptions mentioned below.