From 22b3aa9e7a61df3826d7ee199610578adbe90c32 Mon Sep 17 00:00:00 2001 From: "srvproxy001.itguys.com.br" Date: Sun, 21 Sep 2025 03:49:38 -0300 Subject: [PATCH] =?UTF-8?q?[Auto-Sync]=20Atualiza=C3=A7=C3=A3o=20das=20con?= =?UTF-8?q?figura=C3=A7=C3=B5es=20em=20srvproxy001.itguys.com.br=20-=20202?= =?UTF-8?q?5-09-21=2003:49:38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sites-available/mimir.itguys.com.br.conf | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 nginx/sites-available/mimir.itguys.com.br.conf diff --git a/nginx/sites-available/mimir.itguys.com.br.conf b/nginx/sites-available/mimir.itguys.com.br.conf new file mode 100644 index 0000000..14754b7 --- /dev/null +++ b/nginx/sites-available/mimir.itguys.com.br.conf @@ -0,0 +1,94 @@ +# ============================================================================== +# ARQUIVO: /etc/nginx/sites-available/mimir.itguys.com.br.conf +# AUTOR: Gemini (Especialista NGINX) +# DATA: 21/09/2025 +# +# DESCRIÇÃO: +# Configuração de Proxy Reverso OTIMIZADA e SEGURA para Zabbix. +# +# FUNCIONALIDADES: +# - Redirecionamento canónico forçado para HTTPS. +# - Restrição de Acesso: Acesso limitado à rede interna. +# - Cache Inteligente: Cache ativado apenas para assets estáticos da interface. +# - Bloco `upstream` para fácil manutenção do backend. +# - Cabeçalhos de segurança e organização aprimorada do código. +# ============================================================================== + +# Define o nosso servidor Zabbix como um "upstream" para fácil referência. +upstream zabbix_backend { + server 172.16.254.11; +} + +# ============================================================================== +# BLOCO 1: Redirecionamento de HTTP (porta 80) para HTTPS +# ============================================================================== +server { + listen 80; + listen [::]:80; + server_name mimir.itguys.com.br; + + # Permite a validação do Let's Encrypt antes de qualquer restrição. + location /.well-known/acme-challenge/ { + root /var/www/html; + } + + # Redireciona todo o tráfego para a versão segura. + location / { + return 301 https://$host$request_uri; + } +} + +# ============================================================================== +# BLOCO 2: Servidor Principal - Proxy Reverso para Zabbix (HTTPS) +# ============================================================================== +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name mimir.itguys.com.br; + + # --- CONFIGURAÇÕES DE SSL E SEGURANÇA --- + ssl_certificate /etc/letsencrypt/live/mimir.itguys.com.br/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/mimir.itguys.com.br/privkey.pem; # managed by Certbot + include /etc/nginx/snippets/ssl_params.conf; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "SAMEORIGIN" always; + + # --- POLÍTICAS DE ACESSO E LOGS --- + # A TRAVA DE SEGURANÇA: Restringe o acesso à rede interna. + include /etc/nginx/snippets/internal_networks.conf; + # Bloqueia a indexação por motores de busca. + include /etc/nginx/snippets/global_robots.conf; + # Logs + access_log /var/log/nginx/mimir.itguys.com.br.access.log; + error_log /var/log/nginx/mimir.itguys.com.br.error.log warn; + + # --- PARÂMETROS DE PROXY GLOBAIS --- + include /etc/nginx/snippets/proxy_params.conf; + + # --- REGRAS DE ROTEAMENTO (LOCATIONS) --- + + # 1. Rota para assets estáticos da UI (CACHE AGRESSIVO) + location ~* \.(?:css|js|mjs|svg|gif|png|jpg|jpeg|ico|wasm|woff2?|ttf|eot)$ { + # Define um cache específico para os assets do Zabbix. + proxy_cache zabbix_cache; + proxy_cache_valid 200 7d; # Cache de 7 dias para assets. + proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; + add_header X-Proxy-Cache $upstream_cache_status; + + proxy_pass http://zabbix_backend; + } + + # 2. Rota principal para a aplicação (SEM CACHE) + # Apanha o zabbix.php, dashboards, APIs, etc. + location / { + # Habilita o suporte a WebSockets, caso alguma funcionalidade do Zabbix utilize. + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + proxy_pass http://zabbix_backend; + } + + # --- Páginas de Erro Personalizadas --- + include /etc/nginx/snippets/custom_errors.conf; +}