Browser local cache, that is, when the browser loads a Web page, you can cache some of the content of the Web page, the local content will be loaded again, this can greatly improve the speed of access to the site. For the server side, this will also greatly save network resources.
Browser caching relies on the Expires command output header to achieve:
syntax: Expires [Time|epoch|max|off]
Default value: Expires off
Scope: Http,server,location
Use this directive to control the header information of "Expires" and "Cache-contron" in HTTP reply, and play the role of controlling the page cache.
You can use positive and negative numbers in the time value. The value of the "Expires" header is obtained by adding the time value to the current system.
EOPCH specifies a value of "Expires" of 1 january,1970,00:00:01 GMT.
MAX Specifies a value of December 2037 23:59:59 GMT, and the value of "Cache-control" is 10 years. 1 specifies that the value of "Expires" is the -1s of the current time, i.e. never expires.
The value of the "Cache-control" header is determined by the time you specify.
Off means that the values of "Expires" and "Cache-control" are not modified.
example, if you set the website to common format pictures, flash and other files in the browser local cache for 10 days, the JS, CSS and other dynamic files cache for 1 hours, you can modify or add the following configuration in the server module to achieve:
Server
{
Location ~. *\. (gif|jpg|jpeg|png|bmp|swf) $
{
Expires 10d;
}
Location ~. *\. (JS|CSS) $
{
Expires 1h;
}
}
Nginx setting Browser Local cache