Http.server.location instruction syntax in Nginx

Source: Internet
Author: User

Location is an instruction under the server block under the HTTP block in the Nginx configuration file, and the syntax structure is:

Location [= | ~ | ~* | ^~] URI {...}

[] The inner part is optional, and four identifiers can only be selected to specify how the request string and URI are matched.

If you do not add an optional part, Nginx will first match the request path to all location with the standard URI in order, and then match the location with the regular URI, if there is a regular URI match succeeds then use that location, if there is no regular URI match succeeds, use the A location with the highest match in the standard URI.

"=", strict matching pattern , before the standard URI , requires the request string to match the standard URI Strictly, if successful, immediate processing;

"^~", ignoring the regular URI pattern, before the standard URI, if the request string and the standard URI match the highest, immediately processing;

"~" means that the URI contains a regular expression, which is case-sensitive;

"~*", indicates that the URI contains a regular expression and is not case-sensitive.

The content is referenced from the Nginx high performance Web server and the Nginx official document.

Http.server.location instruction syntax in Nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.