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.
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.
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.
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.
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.