diff --git a/conf.d/ferreirareal.com.br.conf b/conf.d/ferreirareal.com.br.conf index 6081989..65a9d09 100644 --- a/conf.d/ferreirareal.com.br.conf +++ b/conf.d/ferreirareal.com.br.conf @@ -29,9 +29,7 @@ server { server_name ferreirareal.com.br www.ferreirareal.com.br; # Permite a renovação de certificado Let's Encrypt. - location /.well-known/acme-challenge/ { - root /var/www/html; # Ajuste este caminho se necessário. - } + include snippets/acme_challenge.conf; # Redireciona todo o resto para a versão segura e canônica. location / { @@ -122,11 +120,8 @@ server { # --- Estratégia de Cache (IMPORTANTE) --- # Lembre-se de adicionar a linha 'proxy_cache_path' correspondente em nginx.conf! - proxy_cache ferreirareal_cache; # Nome de cache exclusivo para este site. - proxy_cache_revalidate on; - proxy_cache_lock on; - proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; - add_header X-Proxy-Cache $upstream_cache_status; # Mostra se o cache foi HIT, MISS, etc. + proxy_cache ferreirareal_cache; + include snippets/cache_proxy_params.conf; # --- REGRAS DE ROTEAMENTO (LOCATIONS) --- diff --git a/snippets/acme_challenge.conf b/snippets/acme_challenge.conf index bf2ee5a..72ccc3f 100644 --- a/snippets/acme_challenge.conf +++ b/snippets/acme_challenge.conf @@ -2,7 +2,7 @@ # Include this in port 80 server blocks to allow Certbot validation location ^~ /.well-known/acme-challenge/ { - root /var/www/certbot; + root /var/www/html; try_files $uri =404; allow all; auth_basic off; diff --git a/snippets/cache_proxy_params.conf b/snippets/cache_proxy_params.conf new file mode 100644 index 0000000..18185f2 --- /dev/null +++ b/snippets/cache_proxy_params.conf @@ -0,0 +1,7 @@ +# Standard Proxy Cache Settings +# Include this inside server blocks that use proxy_cache + +proxy_cache_revalidate on; +proxy_cache_lock on; +proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; +add_header X-Proxy-Cache $upstream_cache_status; diff --git a/snippets/cache_zones.conf b/snippets/cache_zones.conf index 07f3b8b..b6f2baa 100644 --- a/snippets/cache_zones.conf +++ b/snippets/cache_zones.conf @@ -1,6 +1,7 @@ # Dynamic Shared Cache Zone # Single zone for all sites, separating content by Host + URI proxy_cache_path /var/cache/nginx/dynamic_cache levels=1:2 keys_zone=dynamic_cache:50m max_size=10g inactive=7d use_temp_path=off; +proxy_cache_path /var/cache/nginx/ferreirareal levels=1:2 keys_zone=ferreirareal_cache:10m max_size=1g inactive=7d use_temp_path=off; # Default Cache Key (ensure uniqueness per host) proxy_cache_key "$scheme$request_method$host$request_uri";