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