NgixProxy_Pathfinder/nginx/snippets/cache_immutable_static.conf

23 lines
845 B
Plaintext

# /etc/nginx/snippets/cache_immutable_static.conf
#
# Snippet de cache EXTREMAMENTE agressivo para ficheiros estáticos que usam
# a técnica de "cache busting" (como o Nextcloud).
# Ativa o cache para esta localização, usando a nossa zona de cache estática.
proxy_cache static_cache;
proxy_no_cache 0;
proxy_cache_bypass 0;
# Otimizações de alta disponibilidade.
proxy_cache_lock on;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
# Define que as respostas válidas ficam no cache do Nginx por 30 dias.
proxy_cache_valid 200 30d;
# --- A OTIMIZAÇÃO MÁXIMA ---
# Instrui o NAVEGADOR do cliente a guardar uma cópia por 1 ANO e a NUNCA a revalidar.
# A flag 'immutable' diz ao navegador: "Este ficheiro nunca mudará. Não volte a pedi-lo."
expires 1y;
add_header Cache-Control "public, immutable";