diff --git a/nginx/sites-available/unifi.itguys.com.br.conf b/nginx/sites-available/unifi.itguys.com.br.conf deleted file mode 100644 index 5469fa6..0000000 --- a/nginx/sites-available/unifi.itguys.com.br.conf +++ /dev/null @@ -1,105 +0,0 @@ -# ========================================================================================= -# ARQUIVO: /etc/nginx/sites-available/unifi.itguys.com.br.conf -# AUTOR: Gemini (Especialista NGINX) - VERSÃO 5 (ESTÁVEL E FUNCIONAL) -# DATA: 21/09/2025 -# -# DESCRIÇÃO: -# Esta é a configuração estável que provou ser 100% funcional, resolvendo -# todos os erros de API (403) e WebSocket. Nenhuma otimização de cache ou -# regra de ModSecurity está presente para garantir a máxima compatibilidade. -# ========================================================================================= - -# --- DEFINIÇÃO DOS BACKENDS --- -upstream unifi_backend_web { - server 172.16.254.123:8443; -} -upstream unifi_backend_inform { - server 172.16.254.123:8080; -} - -# ========================================================================================= -# BLOCO 1: Redirecionamento de HTTP (porta 80) para HTTPS -# ========================================================================================= -server { - listen 80; - listen [::]:80; - server_name unifi.itguys.com.br; - - location /.well-known/acme-challenge/ { - root /var/www/html; - } - location / { - return 301 https://$host$request_uri; - } -} - -# ========================================================================================= -# BLOCO 2: Servidor Principal - Proxy Reverso para a Interface Web (HTTPS) -# ========================================================================================= -server { - listen 443 ssl http2; - listen [::]:443 ssl http2; - server_name unifi.itguys.com.br; - - # --- SSL E SEGURANÇA --- - ssl_certificate /etc/letsencrypt/live/unifi.itguys.com.br/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/unifi.itguys.com.br/privkey.pem; - include /etc/nginx/snippets/ssl_params.conf; - add_header X-Frame-Options "SAMEORIGIN" always; - - # --- LOGS --- - access_log /var/log/nginx/unifi.itguys.com.br.access.log; - error_log /var/log/nginx/unifi.itguys.com.br.error.log warn; - - # --- PARÂMETROS GERAIS --- - proxy_ssl_verify off; - include /etc/nginx/snippets/proxy_params.conf; - - # --- ROTA PARA A APLICAÇÃO --- - location / { - proxy_pass https://unifi_backend_web; - - # -- Cabeçalhos Essenciais -- - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Origin ""; - proxy_set_header Referer $scheme://$host/; - } - - # --- ROTA DEDICADA PARA WEBSOCKETS --- - location /wss/ { - proxy_pass https://unifi_backend_web; - - # -- Cabeçalhos Essenciais -- - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - # -- Cabeçalhos para Upgrade de Conexão -- - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - } -} - -# ============================================================================== -# BLOCO 3: Servidor para o "Inform" dos Dispositivos (HTTP na porta 8080) -# ============================================================================== -server { - listen 8080; - listen [::]:8080; - server_name unifi.itguys.com.br; - - access_log /var/log/nginx/unifi-inform.log; - error_log /var/log/nginx/unifi-inform.error.log; - - location / { - include /etc/nginx/snippets/proxy_params.conf; - proxy_read_timeout 600s; - proxy_send_timeout 600s; - proxy_pass http://unifi_backend_inform; - } -}