Tengine Module Documentation: Headers module features

Source: Internet
Author: User
Keywords Module features module documentation
Tags .url added configuration configured content document function html

Ngx_http_headers_module

On the basis of the original setting expiration time of the nginx itself, the expires_by_types instruction is added to set the expiration time according to the Content-type.
The original function introduction look here.

Expires_by_types 24h html; Expires_by_types flushes +24h by; Expires_by_types @15h30m by; Expires_by_types 0 by; Expires_by_types-1 by; Expires_by_types epoch by;

Instructions

Syntax:expires_by_types [[Flushes] time | @time-of-day | epoch | max | off] Content-type1
[Content-type2] [Content-type3] ...
Default:-
Context:http, Server, location

The directive configures the expiration time and its corresponding content-type. The configuration of the expiration time can be referenced by the expires configuration. After configuring the time, you can add one to multiple content-type.

Note that when there are expires and Expires_by_types appear, the rules are as follows:

At the same level, if expires and Expires_by_type are present at the same time, the content-type that appear in Expires_by_type will be given priority in Expires_by_types. Instead of appearing in Content-type, the configuration in expires is selected, and when expires off is not configured at this level and at the previous level, expires and expires_by_types assign inheritance to the previous level of configuration information when there is no configuration at this level. And then follow the rule once; When this level is configured with expires off, the module ignores all configuration of expires_by_types and disables expires, when expires is not configured at this level, and when the upper level is configured with expires off, This level of expires_by_types will not be affected by the expires at the top level.

As:

Location/url {expires 10s; expires_by_types 24s html;}

At this point, url the following document, the HTML type returns the expiration time of 24s, while the other types return 10s of expiration.

Expires 10s; Expires_by_types 24s html; Location/url {expires_by_types 20s text/rss;}

At this point, url the following document, the Text/rss type returns the expiration time of 20s, while the other types return 10s of expiration. Because the expires_by_types inside the location will cover the upper Expires_by_types. The expires 10s was inherited.

Expires 10s; Expires_by_types 24s html; Location/url {expires off; expires_by_types 20s Text/rss;}

At this point, all documents below URL will not have an expiration date.

Expires off; Expires_by_types 24s html; Location/url {expires_by_types 20s text/rss;}

At this point, url the following document, the Text/rss type returns an expiration time of 20s, and no other type of time. Note that expires off does not inherit.

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.