2011년 9월 28일 수요일

[HTTP] mod_expires - http cache

Apache Module mod_expires


Summary
This module controls the setting of the Expires HTTP header and the max-age directive of the Cache-Control HTTP header in server responses. The expiration date can set to be relative to either the time the source file was last modified, or to the time of the client access.

These HTTP headers are an instruction to the client about the document's validity and persistence. If cached, the document may be fetched from the cache rather than from the source until this time has passed. After that, the cache copy is considered "expired" and invalid, and a new copy must be obtained from the source.

To modify Cache-Control directives other than max-age (see RFC 2616 section 14.9), you can use the Header directive.



<IfModule mod_expires.c>

ExpiresActive On

ExpiresDefault "access plus 1 month"    #문서가 기본적으로 접속된지 1달후에 만기된다고 설정
ExpiresDefault "access plus 4 weeks"
ExpiresDefault "access plus 30 days"

ExpiresByType text/html "access plus 1 month 15 days 2 hours"
ExpiresByType image/gif "modification plus 5 hours 3 minutes"

ExpiresByType image/png "access plus 1 hours"
ExpiresByType image/jpeg "access plus 1 hours"
ExpiresByType image/x-icon "access plus 1 hours"
ExpiresByType application/x-javascript "access plus 15 minutes"
ExpiresByType text/css "access plus 1 hours"


<Files "*.png">
        ExpiresActive On
        ExpiresDefault "access plus 1 years"
</Files>
<Files "*.js">
        ExpiresActive On
        ExpiresDefault "access plus 1 minutes"
</Files>
<Files "*.xml">
        ExpiresActive On
        ExpiresDefault "access plus 1 minutes"
</Files>
</IfModule>

댓글 없음:

댓글 쓰기