If you want to enable the browser cache with the new Apache 2.2, you have to enable the module rewrite first and then to restart the Apache:
1 |
sudo a2enmod rewrite && /etc/init.d/apache2 restart |
Add this to the File “/etc/apache2/apache2.conf” :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<ifmodule mod_expires.c> ExpiresActive on ExpiresByType image/x-icon “access plus 2 month” ExpiresByType image/png “access plus 2 month” ExpiresByType image/jpg “access plus 2 month” ExpiresByType image/gif “access plus 2 month” ExpiresByType image/jpeg “access plus 2 month” ExpiresByType application/pdf “access plus 2 month” ExpiresByType audio/x-wav “access plus 2 month” ExpiresByType audio/mpeg “access plus 2 month” ExpiresByType video/mpeg “access plus 2 month” ExpiresByType video/mp4 “access plus 2 month” ExpiresByType video/quicktime “access plus 2 month” ExpiresByType video/x-ms-wmv “access plus 2 month” ExpiresByType application/x-shockwave-flash “access 2 month” ExpiresByType text/css “access plus 24 hour” ExpiresByType text/javascript “access plus 2 hour” </ifmodule> |
This is an example config, for images I choose 2,CSS 1day and for JavaScript 2 Hours from the last access.