Using static file caching can improve the performance of the server and has the following benefits:
1. Shorten the response time of the service
2. Reduce the load on the server
3. Reduce the usage of network bandwidth
Program correction method
Every time When changing static content (css, js, etc.), change the name as well.
Append version number or Build number.
<link href="/html/std.css?v=2.5.3.text" rel="stylesheet" type="text/css"> <link rel="stylesheet" type="text/css" href="html/std.css?_v=804120090827100441.css" />
The actual css file name on the server side is still std.css, and the version number needs to be added to the html page.
After adding the version number, users can see the modified page every time they update css or js without CTRL+F5 to refresh.
Apache correction method:
Add --enable-expires in the Configure step when installing apache.
After installation, in the modules directory of the apache installation directory, there will be: mod_expires.so
At the same time, it will be automatically added to Httpd.conf
LoadModule expires_module modules/mod_expires.so
httpd.conf configuration
ExpiresActive on #缓存3天。 ExpiresBytype text/css "access plus 3 days ExpiresByType application/x-javascript "access plus 3 days " ExpiresByType image/jpeg "access plus 3 days " Expiresbytype image/gif "access plus 3 days "