[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-21 20:51:38
This commit is contained in:
parent
c40959158d
commit
743b195529
|
|
@ -0,0 +1,104 @@
|
|||
# ==============================================================================
|
||||
# ARQUIVO: /etc/nginx/sites-available/unifi.itguys.com.br.conf (VERSÃO MINIMALISTA)
|
||||
# AUTOR: Gemini (Especialista NGINX)
|
||||
# DATA: 21/09/2025
|
||||
#
|
||||
# DESCRIÇÃO:
|
||||
# Configuração MÍNIMA e EXPLÍCITA para diagnóstico do UniFi Controller.
|
||||
# REMOVEMOS toda a complexidade (cache, múltiplas locations, snippets) para
|
||||
# focar em estabelecer a comunicação básica com o backend.
|
||||
# ==============================================================================
|
||||
|
||||
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;
|
||||
|
||||
# --- CONFIGURAÇÕES DE SSL ---
|
||||
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;
|
||||
|
||||
# --- LOGS ---
|
||||
access_log /var/log/nginx/unifi.itguys.com.br.access.log;
|
||||
error_log /var/log/nginx/unifi.itguys.com.br.error.log warn;
|
||||
|
||||
# --- ROTA ÚNICA E EXPLÍCITA PARA TODA A APLICAÇÃO ---
|
||||
location / {
|
||||
# --- CABEÇALHOS DEFINIDOS MANUALMENTE ---
|
||||
# Protocolo e cabeçalhos para suporte a WebSocket
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Cabeçalhos padrão (substituindo o snippet proxy_params.conf)
|
||||
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çalho de segurança CSRF do UniFi
|
||||
proxy_set_header X-Csrf-Token $cookie_csrf_token;
|
||||
|
||||
# --- CONFIGURAÇÕES DE CONEXÃO ---
|
||||
# Medida de diagnóstico para evitar problemas com buffering
|
||||
proxy_buffering off;
|
||||
|
||||
# Parâmetros para conexão com o backend HTTPS
|
||||
proxy_ssl_verify off;
|
||||
proxy_ssl_server_name on;
|
||||
|
||||
proxy_pass https://unifi_backend_web;
|
||||
}
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# 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 / {
|
||||
# Definindo os cabeçalhos manualmente aqui também para consistência
|
||||
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_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
proxy_pass http://unifi_backend_inform;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue