Nginx configuration

Nginx configuration

1. Nginx location configuration

 

  ★Syntax: location [=|~|~*|^~] /uri/ { … }

 

  ★ Matching rules


    1. location empty Path

 

      Understanding: if it matches exactly, then terminate;
      if only this Path is the largest prefix, then it will be searched later (including regular).
      For example: / Universal match, any request will be matched.
    2. location = Path

 

      Understanding: must match exactly

 

    3. location ^~ Path: Indicates non-regular, and does not search for regular after matching

 

      Understanding: As long as it starts with Path, it will be executed, and the following regular expression will not be executed.

 

    4. location ~ Regex (case sensitive)

    5. location ~* Regex (case insensitive)

 

  The matching between regular expressions is related to the writing order. As long as the first one is matched, the subsequent matching will be stopped.

 

  ★The matching order of location is actually "match normal first, then match regular". The reason for the misunderstanding is that regular matching overrides normal matching

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325022591&siteId=291194637