Created
May 8, 2025 12:39
-
-
Save wellington1993/5aa8405a2d3872eeaeea218ad96b3af4 to your computer and use it in GitHub Desktop.
Cache Static Files Nginx
This file contains hidden or 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
# 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