Introduction to how to set up static file cache in apache_PHP tutorial

WBOY
Release: 2016-07-20 11:16:50
Original
904 people have browsed it

In order to reduce the client’s request for server resources, you can enable the mod_expires.so module

Remove this paragraph in apache%C5%E4%D6%C3/" target="_blank">apache configuration file

"#LoadModule expires_module modules/mod_expires.so

"The # sign in front of it


Httpd.conf configuration

The code is as follows
 代码如下  

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 "

ExpiresActive on


#Cache for 3 days.

 代码如下  

# mod_expires
ExpiresActive on
ExpiresDefault A864000
ExpiresBytype text/css “access plus 14 days
ExpiresByType text/javascript “access plus 14 days ”
ExpiresByType application/x-javascript “access plus 14 days ”
ExpiresByType application/x-shockwave-flash “access plus 14 days ”
ExpiresByType image/* “access plus 14 days ”
ExpiresByType text/html “access plus 14 days ”

ExpiresDefault A864000

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 "

Add the following content
The code is as follows
# mod_expires ExpiresActive on ExpiresDefault A864000 ExpiresBytype text/css “access plus 14 days ExpiresByType text/javascript “access plus 14 days ” ExpiresByType application/x-javascript “access plus 14 days ” ExpiresByType application/x-shockwave-flash “access plus 14 days ” ExpiresByType image/* “access plus 14 days ” ExpiresByType text/html “access plus 14 days ” ExpiresDefault A864000
The default cache time is 10 days, and the css cache time is 14 days http://www.bkjia.com/PHPjc/372544.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/372544.htmlTechArticleIn order to reduce the client’s request for server resources, you can enable the mod_expires.so module in apache%C5%E4% D6%C3/ target=_blankapache remove this paragraph #LoadModule expires_module...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template