refactor: usa snippets para acme e cache params
This commit is contained in:
parent
91ee957ba7
commit
c4bf1050b7
|
|
@ -29,9 +29,7 @@ server {
|
||||||
server_name ferreirareal.com.br www.ferreirareal.com.br;
|
server_name ferreirareal.com.br www.ferreirareal.com.br;
|
||||||
|
|
||||||
# Permite a renovação de certificado Let's Encrypt.
|
# Permite a renovação de certificado Let's Encrypt.
|
||||||
location /.well-known/acme-challenge/ {
|
include snippets/acme_challenge.conf;
|
||||||
root /var/www/html; # Ajuste este caminho se necessário.
|
|
||||||
}
|
|
||||||
|
|
||||||
# Redireciona todo o resto para a versão segura e canônica.
|
# Redireciona todo o resto para a versão segura e canônica.
|
||||||
location / {
|
location / {
|
||||||
|
|
@ -122,11 +120,8 @@ server {
|
||||||
|
|
||||||
# --- Estratégia de Cache (IMPORTANTE) ---
|
# --- Estratégia de Cache (IMPORTANTE) ---
|
||||||
# Lembre-se de adicionar a linha 'proxy_cache_path' correspondente em nginx.conf!
|
# 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 ferreirareal_cache;
|
||||||
proxy_cache_revalidate on;
|
include snippets/cache_proxy_params.conf;
|
||||||
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.
|
|
||||||
|
|
||||||
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
|
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# Include this in port 80 server blocks to allow Certbot validation
|
# Include this in port 80 server blocks to allow Certbot validation
|
||||||
|
|
||||||
location ^~ /.well-known/acme-challenge/ {
|
location ^~ /.well-known/acme-challenge/ {
|
||||||
root /var/www/certbot;
|
root /var/www/html;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
allow all;
|
allow all;
|
||||||
auth_basic off;
|
auth_basic off;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# Dynamic Shared Cache Zone
|
# Dynamic Shared Cache Zone
|
||||||
# Single zone for all sites, separating content by Host + URI
|
# 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/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)
|
# Default Cache Key (ensure uniqueness per host)
|
||||||
proxy_cache_key "$scheme$request_method$host$request_uri";
|
proxy_cache_key "$scheme$request_method$host$request_uri";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue