Syntax: Expires [Time|epoch|max|off]
Default value: Expires off
Scope: HTTP, server, location
Use this directive to control the headers of "Expires" and "Cache-control" in HTTP replies (as a function of controlling page caching).
You can use a positive or negative number in the time value. The value of the "Expires" header is obtained by adding the time value you set for the current system.
The epoch specifies a value of "Expires" of 1 January, 1970, 00:00:01 GMT.
MAX specifies that the value of "Expires" is December 2037 23:59:59 GMT, and the value of "Cache-control" is 10 years.
1 specifies that the value of "Expires" is -1s the current time of the server, i.e. forever expires
The value of the "Cache-control" header is determined by the time you specify:
Negative Number: Cache-control:no-cache
Positive or 0: Cache-control:max-age = #, # Specifies the number of seconds for your time.
"Off" means that the values of "Expires" and "Cache-control" are not modified
Demo
Control pictures and other expiration time is 30 days, of course, this time can be set longer. Depending on the situation
Like what
location~ \. (Gif|jpg|jpeg|png|bmp|ico) $ {
Expires 30d;
}
Control all file cache settings to match/resource/or/mediatormodule/to maximum time
Like what
Location ~/(Resource|mediatormodule)/{
Root/opt/demo;
Expires Max;
}
Nginx expires cache boosts Web site load