Nginx rewrite and gzip functions, nginxrewritegzip

Source: Internet
Author: User

Nginx rewrite and gzip functions, nginxrewritegzip

Rewrite Module name: ngx_http_rewrite_module is automatically compiled by default.

Command: rewrite regex replacement [flag]

Regex: a regular expression used to match the uri of a user request.

Replacement: result after Rewriting

Flag:

Last: After rewriting, stop processing the current uri. Change it to a new round of processing for the new uri, which is completed within nginx, and the client will not notice

Break: After rewriting, stop processing the current uri and switch to other configurations.

Redirect: After the rewrite is completed, a temporary redirection will be returned to the client, which initiates a request to the new uri (302)

Permanent: After the rewrite is completed, a permanent redirection is returned to the client, which initiates a request (301) to the new uri)

 

Instance:

Server {

...

Rewrite ^ (/download/. *)/media/(. *) \... * $1/mp3/Listen 2.mp3 last

...

}

. * Indicates any content, \. indicates to escape. $1 indicates to reference the content in the first () and so on.

Http://www.c.com/download

 

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.