This estimate depends on the CDN settings of different service providers, and the following are the Nginx caching policy settings of Alibaba Cloud's CDN
HTTP Headers, which allows arbitrary HTTP headers to be set
1) add_header
Syntax: add_header name value
Default: none
Use the following fields: http, server, location
2) expires
Syntax: expires [time|epoch|max|off]
Default: expires off
Use the following fields: http, server, location
This directive controls whether an expiration time is marked in the response, and if so, how.
off will prohibit modification of the Expires and Cache-Control fields in the header.
Time controls the value of "Cache-Control", and negative numbers indicate no-cache
epoch set the Expires header to 1 January, 1970 00:00:01 GMT.
max set the Expires header to 31 December 2037 23:59:59 GMT, maxing out Cache-Control to 10 years.
For example, set the file type expiration time of PHP to 1 hour:
Set the file type of php to no-cache to prevent cache server from caching:
In addition, you can set the corresponding caching policy through add_header, and set it to no cache for dynamic PHP files:- location ~ .*\.php$ {
- if ($request_uri !~ ^/dynamicimg/) {
- add_header Cache-Control "no-cache";
- add_header Pragma no-cache;
- }
- }
Copy code
|