Created
March 8, 2010 16:08
-
-
Save xenda/325300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Location /> | |
# Insert filter | |
SetOutputFilter DEFLATE | |
# Netscape 4.x nos da algunos problemas | |
BrowserMatch ^Mozilla/4 gzip-only-text/html | |
# Netscape 4.06-4.08 tambien | |
BrowserMatch ^Mozilla/4\.0[678] no-gzip | |
# MSIE se enmascara como Netscape a veces | |
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | |
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html | |
# No válido para imágenes | |
SetEnvIfNoCase Request_URI \ | |
\.(?:gif|jpe?g|png)$ no-gzip dont-vary | |
</Location> | |
# Expira en 0 | |
ExpiresActive On | |
ExpiresDefault A0 | |
#Cache de archivos por 1 año | |
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|png|jpg|gif|jpep|js|css)$"> | |
ExpiresDefault A29030400 | |
#Header append Cache-Control "public" | |
</FilesMatch> | |
#FileETag none | |
#Etags basados en tamaño | |
FileETag MTime Size | |
# Se habilita Rewrite | |
RewriteEngine On | |
# Variable de entorno "is_versioned" si hay un query string de numeros | |
RewriteCond %{QUERY_STRING} ^[0-9]+$ | |
RewriteRule ^(.*)$ $1 [env=is_versioned:true] | |
<Directory /home/[..]/public_html/[..]/public/ > | |
Options -Indexes FollowSymLinks -MultiViews | |
AllowOverride None | |
Order allow,deny | |
allow from all | |
#For files, force the browser to rely on cache-control directives and | |
#Rails asset timestamps by removing Etags and Last-Modified dates | |
# Todos los assets que no sean de rails viven 3 horas | |
Header set "Cache-Control" "max-age=25920000" | |
Header unset Etag | |
#Header unset "Last-Modified" | |
#Los que vienen de Rails, 30 días | |
Header set "Cache-Control" "max-age=2592000" env=is_versioned | |
</Directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A nivel de Site | |
gzip on; | |
gzip_comp_level 2; | |
gzip_http_version 1.0; | |
gzip_buffers 16 8k; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_proxied any; | |
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
# Si existe el archivo "$root"/system/maintenance, redirige todo el tráfico a éste | |
if (-f $document_root/system/maintenance.html) { | |
rewrite ^(.*)$ /system/maintenance.html last; | |
break; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Si el archivo existe ya, servirlo directamente (Rails trata de encontrarlo como un archivo de vista innecesariamente) | |
if (-f $request_filename) { | |
break; | |
} | |
# Si ya existen los archivos con extensión .html | |
# servirlos directamente | |
if (-f $request_filename.html) { | |
rewrite (.*) $1.html break; | |
} | |
# Cabecera de expiración para los que no tengan timestamp | |
location ~* \.(ico|swf|css|js|gif|jp?g|png)(\?[0-9]+)?$ { | |
expires max; | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment