Skip to content

Instantly share code, notes, and snippets.

@wellington1993
Created May 8, 2025 12:39
Show Gist options
  • Save wellington1993/5aa8405a2d3872eeaeea218ad96b3af4 to your computer and use it in GitHub Desktop.
Save wellington1993/5aa8405a2d3872eeaeea218ad96b3af4 to your computer and use it in GitHub Desktop.
Cache Static Files Nginx
# Cache para Assets Estáticos (Seu bloco aprimorado)
# Inclui diversas extensões e define cache longo com immutable (para cache busting)
location ~* \.(css|js|jpg|jpeg|png|gif|webp|avif|woff2|woff|ttf|otf|mp4|webm|svg|ico)$ {
expires 365d; # Define Expires para 1 ano
add_header Cache-Control "public, immutable, max-age=31536000"; # Complementa Cache-Control
add_header Vary "Accept-Encoding"; # Importante para compressão
access_log off; # Desativa log de acesso para estáticos
etag on; # Garante ETags atualizados (explícito por clareza)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment