1. Because the overall site only .html .jpg .png .gif .apk files, and other files are not cached; You can first set the entire site to non-cache as follows:
a) Open IIS Information Manager, right-click on the properties of the service website "a.cc.com", then select the HTTP header option, check "Enable content expiration", select "Expir now", and then "OK", as follows:
b) After the above settings, the entire website content will not be cached by the CDN, and then set a caching policy for .html .jpg .png .gif .apk file types
2. The cache settings for specific files are as follows:
a) If the files with different extensions above are placed separately under a specific directory, and there are no files with other extensions in that directory, then the cache time can be set for the entire directory where the extension is located; The specific method is to expand the directory of the website "a.cc.com" in the "IIS Information Manager", and select the directory that needs to set the cache time, for example, all jpg is stored in the directory of img, then right-click on the directory, select "Properties", and select the "HTTP header" selector; Because the entire website has set the non-caching setting just now, so the cache settings of the "HTTP header" of the directory are the same as those in 1, and then you can modify this configuration: select "Expire after this time period", and set the time to the expiration time value, such as 14 days, click "OK" to save, as follows:
b) If the files with a specific extension are not uniformly placed in a unique directory, but are mixed with other extension files under the same directory, the configuration is more complicated;
In order to avoid configuring files with specific extensions one by one, we need to make IIS support "wildcards", and the configuration that supports "wildcards" is as follows:
1) Open IIS Information Manager, right-click the attribute of the service website a.cc.com, select the Home directory tab, and click the Configure button on the tab, and the following dialog box appears:
2) Under the "Wildcard Application Mapping (Execution Order)" column, click the "Insert" button and select C: WINDOWSMicrosoft.NETFramework in the file selection box that pops up4.0.30319aspnet_isapi.dll file, where "C:" is the system disk, do not check "Confirm whether the file exists", as follows:
After clicking two "OK" buttons in a row, the support configuration of IIS wildcards is completed
3) Next, go to the directory where there is a cache configuration file, first select a file that needs to cache the extension, right-click, select Properties, select the "HTTP header" card, perform the configuration in 2.a), and save; Next, there is a setting for all files with the same extension under this file directory, at this time you need to modify the configuration file implementation of IIS.
4) The configuration file of IIS is placed in C:WINDOWSsystem32inetsrvMetaBase.xml (IIS6 settings), open the above file with the "Notepad" program, if we have set the cache expiration time for the test.jpg under the bin directory in 3), then we will look for the string "/bin/test.jpg", test.jpg In order to make all jpg files under the bin directory use this cache setting, you only need to change "test.jpg" to "*.jpg", and then keep the file. Note: To modify the above files, you need to turn off IIS admin Service in Services.
5) File cache settings with other extensions can repeat the 3) and 4) operations above.
|