Nginx directory automatic Slash, location example

Source: Internet
Author: User
Keywords Nginx automatic slash
Tags aliyun automatic automatic slash basic basic syntax directory example host

Nginx Directory automatic Slash:

if (-D $request _filehttp://www.aliyun.com/zixun/aggregation/11696.html ">name") {
Rewrite ^/(. *) ([^/]) $ http://$host/$1$2/permanent;
}

Nginx Location

1. Basic syntax: [basically consistent with the above rewrite regular matching syntax]

Location [=|~|~*|^~]/uri/{...}

* To match case sensitivity
* ~* matching for case-insensitive
*!~ and!~* are case insensitive and case-insensitive mismatches, respectively

Example 1:

Location =/{
# matches the query/only.
# only match/query.
}

Matches any query because all requests have been/started. But regular expression rules and long block rules will be matched by precedence and query

Example 2:

Location ^~/images/{
# matches any query beginning With/images/and halts searching,
# so regular expressions won't be checked.

# matches any queries that have been/images/and stops searching. Any regular expressions will not be tested.

Example 3:

Location ~*. (Gif|jpg|jpeg) $ {
# matches any request ending in gif, JPG, or JPEG. However, all
# requests to the/images/directory'll be handled by
}
# matches any requests that have an end of GIF, JPG, or JPEG.

Related Article

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.