Select Page

Speed up your apache server with mod_expires

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.

How to activate
# vi /etc/apache2/conf.d/mod_expires.conf

config is rough right now, but it is better than nothing,put the following in the file

LoadModule evasive20_module     /usr/lib/apache2/
<IfModule mod_expires.c>
 ExpiresActive On

 ExpiresDefault "access plus 1 month"
 #ExpiresByType text/html "access plus 1 month 15 days 2 hours"
 #ExpiresByType image/gif "modification plus 1 month"
 #ExpiresByType image/png "modification plus 1 month"
 #ExpiresByType image/jpg "modification plus 1 month"
 #ExpiresByType text/css "access plus 1 month 15 days 2 hours"
 #ExpiresByType text/javascript "access plus 1 month 15 days 2 hours"

You can also set the expire header by type, but it wa snot working in my case, that is why I use the ExpiresDefault directive

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments


Would love your thoughts, please comment.x