Optimiza Apache con mod_expires

,

Comandos:

Activar modulo:

a2enmod expires

Editar fichero de configuración:

vi /etc/apache2/mods-available/expires.conf

Añadir:

<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/jpg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType text/css "access plus 1 days"
ExpiresByType image/svg+xml "access plus 30 days"
ExpiresByType image/x-icon "access plus 60 days"
ExpiresByType application/pdf "access plus 2 days"
ExpiresByType text/javascript "access plus 12 hours"
ExpiresByType application/x-javascript "access plus 12 hours"
ExpiresByType application/javascript "access plus 12 hours"
</IfModule>

Reiniciar:

/etc/init.d/apache2 restart