Para ello necesitamos cargar unos modulos en Apache:
- mod_deflate: El cual se encarga de comprimir la salida del bufer de nuestro Servidor Web.
- mod_expire: Nos da la posibilidad de controlar la expiracion de archivos.
- Instale los modulos al Apache.
- Agrege a httpd.conf en htdocs o directorio raiz de su servidor web lo siguiente:
- Para el DEFLATE:
AddOutputFilterByType DEFLATE text/html text/xml text/css
AddOutputFilterByType DEFLATE text/javascript text/x-javascript text/js text/x-js
AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/js application/x-js
AddOutputFilterByType DEFLATE application/x-www-form-urlencoded
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
- Para el Expire (expirara cada 72 horas los archivos con estas extensiones):
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/png A2592000
ExpiresByType text/css A2592000
ExpiresByType application/javascript A2592000
- Para Etags (El cual nos sirve para saber cuando volver a cachear un archivo):