[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-21 07:05:12

This commit is contained in:
srvproxy001.itguys.com.br 2025-09-21 07:05:12 -03:00
parent 31eaa9d51a
commit e2d43cb863
1 changed files with 32 additions and 41 deletions

View File

@ -57,55 +57,46 @@ server {
# BLOCO 2: Servidor Principal - Proxy Reverso para a Interface Web (HTTPS) # BLOCO 2: Servidor Principal - Proxy Reverso para a Interface Web (HTTPS)
# ============================================================================== # ==============================================================================
server { server {
listen 443 ssl http2;     listen 443 ssl http2;
listen [::]:443 ssl http2;     listen [::]:443 ssl http2;
server_name unifi.itguys.com.br;     server_name unifi.itguys.com.br;
# --- CONFIGURAÇÕES DE SSL E SEGURANÇA ---     # --- CONFIGURAÇÕES DE SSL E SEGURANÇA ---
ssl_certificate /etc/letsencrypt/live/unifi.itguys.com.br/fullchain.pem; # managed by Certbot     ssl_certificate /etc/letsencrypt/live/unifi.itguys.com.br/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/unifi.itguys.com.br/privkey.pem; # managed by Certbot     ssl_certificate_key /etc/letsencrypt/live/unifi.itguys.com.br/privkey.pem; # managed by Certbot
include /etc/nginx/snippets/ssl_params.conf;     include /etc/nginx/snippets/ssl_params.conf;
add_header X-Content-Type-Options "nosniff" always;     add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;     add_header X-Frame-Options "SAMEORIGIN" always;
# --- POLÍTICAS DE ACESSO E LOGS ---     # --- POLÍTICAS DE ACESSO E LOGS ---
include /etc/nginx/snippets/internal_networks.conf;     include /etc/nginx/snippets/internal_networks.conf;
include /etc/nginx/snippets/global_robots.conf;     include /etc/nginx/snippets/global_robots.conf;
access_log /var/log/nginx/unifi.itguys.com.br.access.log;     access_log /var/log/nginx/unifi.itguys.com.br.access.log;
error_log /var/log/nginx/unifi.itguys.com.br.error.log warn;     error_log /var/log/nginx/unifi.itguys.com.br.error.log warn;
# --- PARÂMETROS DE PROXY GLOBAIS ---     # --- PARÂMETROS DE PROXY GLOBAIS ---
include /etc/nginx/snippets/proxy_params.conf;     include /etc/nginx/snippets/proxy_params.conf;
# Essencial para o proxy funcionar com o backend HTTPS autoassinado do UniFi.     proxy_ssl_verify off;
proxy_ssl_verify off;
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---     # --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
# 1. Rota para assets estáticos (CACHE AGRESSIVO)     # Rota Única para a aplicação (SEM CACHE, COM WEBSOCKETS).
location ~* ^/(static|v2|js|css|fonts|images)/ {     # Esta regra centralizada garante que todos os requests, incluindo assets,
proxy_cache unifi_cache;     # sejam enviados corretamente para o backend do UniFi.
proxy_cache_valid 200 7d;     location / {
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;         proxy_http_version 1.1;
add_header X-Proxy-Cache $upstream_cache_status;         proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
proxy_pass https://unifi_backend_web;         # Cabeçalhos essenciais para o proxy funcionar corretamente com o UniFi
}         proxy_set_header Authorization "";
        proxy_set_header Host $host;
# 2. Rota principal para a aplicação (SEM CACHE, COM WEBSOCKETS)         proxy_pass https://unifi_backend_web;
location / {     }
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Adicione estas duas linhas para resolver o erro 400     # --- Páginas de Erro Personalizadas ---
proxy_set_header Authorization "";     include /etc/nginx/snippets/custom_errors.conf;
proxy_set_header Host $host;
proxy_pass https://unifi_backend_web;
}
# --- Páginas de Erro Personalizadas ---
include /etc/nginx/snippets/custom_errors.conf;
} }
# ============================================================================== # ==============================================================================