[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-21 07:22:39
This commit is contained in:
parent
118299e918
commit
70b7b5aade
|
|
@ -3,18 +3,18 @@
|
||||||
# AUTOR: Gemini (Especialista NGINX)
|
# AUTOR: Gemini (Especialista NGINX)
|
||||||
# DATA: 21/09/2025
|
# DATA: 21/09/2025
|
||||||
#
|
#
|
||||||
# DESCRIÇÃO:
|
# DESCRICAO:
|
||||||
# Configuração de Proxy Reverso OTIMIZADA e SEGURA para UniFi Controller.
|
# Configuracao de Proxy Reverso OTIMIZADA e SEGURA para UniFi Controller.
|
||||||
#
|
#
|
||||||
# FUNCIONALIDADES:
|
# FUNCIONALIDADES:
|
||||||
# - Bloco 1: Redirecionamento de HTTP (porta 80) para HTTPS.
|
# - Bloco 1: Redirecionamento de HTTP (porta 80) para HTTPS.
|
||||||
# - Bloco 2: Proxy para a Interface Web (HTTPS na 443 -> HTTPS na 8443)
|
# - Bloco 2: Proxy para a Interface Web (HTTPS na 443 -> HTTPS na 8443)
|
||||||
# - Suporte a WebSockets para a UI em tempo real.
|
# - Suporte a WebSockets para a UI em tempo real.
|
||||||
# - Cache para assets estáticos da interface.
|
# - Cache para assets estaticos da interface.
|
||||||
# - Lida com o certificado autoassinado do backend UniFi.
|
# - Lida com o certificado autoassinado do backend UniFi.
|
||||||
# - Bloco 3: Proxy para o "Inform" dos Dispositivos (HTTP na 8080 -> HTTP na 8080)
|
# - Bloco 3: Proxy para o "Inform" dos Dispositivos (HTTP na 8080 -> HTTP na 8080)
|
||||||
# - Permite que APs e Switches se comuniquem com o controlador através do proxy.
|
# - Permite que APs e Switches se comuniquem com o controlador atraves do proxy.
|
||||||
# - Acesso restrito à rede interna em todas as portas.
|
# - Acesso restrito a rede interna em todas as portas.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# Define o backend da interface web do UniFi (HTTPS).
|
# Define o backend da interface web do UniFi (HTTPS).
|
||||||
|
|
@ -40,12 +40,12 @@ server {
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name unifi.itguys.com.br;
|
server_name unifi.itguys.com.br;
|
||||||
|
|
||||||
# Permite a validação do Let's Encrypt.
|
# Permite a validacao do Let's Encrypt.
|
||||||
location /.well-known/acme-challenge/ {
|
location /.well-known/acme-challenge/ {
|
||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Redireciona todo o tráfego web para a versão segura.
|
# Redireciona todo o trafego web para a versao segura.
|
||||||
location / {
|
location / {
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host$request_uri;
|
||||||
}
|
}
|
||||||
|
|
@ -58,45 +58,45 @@ server {
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
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 ---
|
# --- CONFIGURACOES DE SSL E SEGURANCA ---
|
||||||
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 ---
|
# --- POLITICAS 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 ---
|
# --- PARAMETROS DE PROXY GLOBAIS ---
|
||||||
include /etc/nginx/snippets/proxy_params.conf;
|
include /etc/nginx/snippets/proxy_params.conf;
|
||||||
proxy_ssl_verify off;
|
proxy_ssl_verify off;
|
||||||
|
|
||||||
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
|
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
|
||||||
|
|
||||||
# Rota Única para a aplicação (SEM CACHE, COM WEBSOCKETS).
|
# Rota Unica para a aplicacao (SEM CACHE, COM WEBSOCKETS).
|
||||||
# Esta regra centralizada garante que todos os requests, incluindo assets,
|
# Esta regra centralizada garante que todos os requests, incluindo assets,
|
||||||
# sejam enviados corretamente para o backend do UniFi.
|
# sejam enviados corretamente para o backend do UniFi.
|
||||||
location / {
|
location / {
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
# Cabeçalhos essenciais para o proxy funcionar corretamente com o UniFi
|
# Cabecalhos essenciais para o proxy funcionar corretamente com o UniFi
|
||||||
proxy_set_header Authorization "";
|
proxy_set_header Authorization "";
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
proxy_pass https://unifi_backend_web;
|
proxy_pass https://unifi_backend_web;
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Páginas de Erro Personalizadas ---
|
# --- Paginas de Erro Personalizadas ---
|
||||||
include /etc/nginx/snippets/custom_errors.conf;
|
include /etc/nginx/snippets/custom_errors.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ server {
|
||||||
listen [::]:8080;
|
listen [::]:8080;
|
||||||
server_name unifi.itguys.com.br;
|
server_name unifi.itguys.com.br;
|
||||||
|
|
||||||
# --- POLÍTICAS DE ACESSO E LOGS ---
|
# --- POLITICAS DE ACESSO E LOGS ---
|
||||||
include /etc/nginx/snippets/internal_networks.conf;
|
include /etc/nginx/snippets/internal_networks.conf;
|
||||||
access_log /var/log/nginx/unifi-inform.log;
|
access_log /var/log/nginx/unifi-inform.log;
|
||||||
error_log /var/log/nginx/unifi-inform.error.log;
|
error_log /var/log/nginx/unifi-inform.error.log;
|
||||||
|
|
@ -117,7 +117,7 @@ server {
|
||||||
location / {
|
location / {
|
||||||
include /etc/nginx/snippets/proxy_params.conf;
|
include /etc/nginx/snippets/proxy_params.conf;
|
||||||
|
|
||||||
# Timeouts mais longos para suportar provisionamento e atualizações de firmware.
|
# Timeouts mais longos para suportar provisionamento e atualizacoes de firmware.
|
||||||
proxy_read_timeout 600s;
|
proxy_read_timeout 600s;
|
||||||
proxy_send_timeout 600s;
|
proxy_send_timeout 600s;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue