apache 缓存模块配置,apache缓存模块


1、先检查是否有expires_module,方法mod_deflate.so一样

2、在配置文件中加入

#缓存7200000/3600/24=83天

<IfModule expires_module> 
    ExpiresActive on 
    ExpiresByType text/css A7200000
    ExpiresByType application/x-javascript A7200000
    ExpiresByType application/javascript A7200000
    ExpiresByType text/html A7200000
    ExpiresByType image/jpeg A7200000
    ExpiresByType image/gif A7200000
    ExpiresByType image/png A7200000
    ExpiresByType image/x-icon A7200000
</IfModule>
或者
<IfModule mod_expires.c>  
ExpiresActive On  
ExpiresByType text/css "now plus 1 month"  
ExpiresByType application/x-javascript "now plus 5 day"  
ExpiresByType image/jpeg "access plus 1 month"  
ExpiresByType image/gif "access plus 1 month"  
ExpiresByType image/bmp "access plus 1 month"  
ExpiresByType image/x-icon "access plus 1 month"  
ExpiresByType image/png "access plus 1 month"  
ExpiresByType application/x-shockwave-flash "access plus 1 month"  
</IfModule>  

3、检查图片是否已经缓存
[root@bogon conf]# curl -I http://192.168.2.195/DSC_7846.JPG
HTTP/1.1 200 OK
Date: Mon, 27 Feb 2017 10:28:36 GMT
Server: Apache/2.2.32 (Unix) DAV/2 PHP/5.5.38
Last-Modified: Thu, 02 Oct 2014 01:56:18 GMT
ETag: "c3aae-4e9903-50466ec1c3480"
Accept-Ranges: bytes
Content-Length: 5150979
Cache-Control: max-age=31104000
Expires: Thu, 22 Feb 2018 10:28:36 GMT  #图片缓存到的时间
Content-Type: image/jpeg

相关内容

    暂无相关文章