[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-27 18:08:30
This commit is contained in:
parent
25686b3cce
commit
3aed3ffe2f
|
|
@ -0,0 +1,125 @@
|
||||||
|
# =================================================================================================
|
||||||
|
# ARQUIVO: mimir.itguys.com.br (Zabbix)
|
||||||
|
# AUTOR: Gemini (Especialista NGINX)
|
||||||
|
# DATA: 27/09/2025 - 18:06
|
||||||
|
# VERSÃO: 5.0 (Padrão Autocontido, Correção de SSL e Hardening de Segurança)
|
||||||
|
#
|
||||||
|
# DESCRIÇÃO:
|
||||||
|
# Configuração autocontida para Zabbix. Corrige o erro de SSL, elimina snippets,
|
||||||
|
# integra as políticas globais de segurança (GeoIP, Rate Limit, Bot Block) e
|
||||||
|
# mantém as otimizações de performance específicas da aplicação.
|
||||||
|
# =================================================================================================
|
||||||
|
|
||||||
|
# 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;
|
||||||
|
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root /var/www/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
# --- CONTROLE DE ACESSO (TRAVA DE SEGURANÇA) ---
|
||||||
|
# Utiliza o bloco 'geo' do nginx.conf para permitir acesso apenas à rede interna.
|
||||||
|
if ($is_internal = 0) {
|
||||||
|
return 403 Forbidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- Logs Dedicados (Padronizado) ---
|
||||||
|
access_log /var/log/nginx/mimir.itguys.com.br.access.log detailed_proxy;
|
||||||
|
access_log /var/log/nginx/mimir.itguys.com.br.bad-bot.log suspicious_bot if=$block_request;
|
||||||
|
error_log /var/log/nginx/mimir.itguys.com.br.error.log warn;
|
||||||
|
|
||||||
|
# --- Segurança (Integração com nginx.conf) ---
|
||||||
|
if ($block_request) {
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
limit_req zone=global_limit burst=50 nodelay; # Burst alto para dashboards Zabbix
|
||||||
|
limit_req zone=bad_bot_limit;
|
||||||
|
|
||||||
|
# --- Configurações de SSL/TLS (Corrigido e Padronizado) ---
|
||||||
|
ssl_certificate /etc/letsencrypt/live/mimir.itguys.com.br/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/mimir.itguys.com.br/privkey.pem;
|
||||||
|
ssl_trusted_certificate /etc/letsencrypt/live/mimir.itguys.com.br/fullchain.pem;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_prefer_server_ciphers off;
|
||||||
|
# CORRIGIDO: Lista de cifras padronizada para máxima compatibilidade e segurança.
|
||||||
|
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
|
||||||
|
ssl_session_timeout 1d;
|
||||||
|
ssl_session_tickets off;
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
|
|
||||||
|
# --- Cabeçalhos de Segurança ---
|
||||||
|
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||||
|
# CSP específica para Zabbix, mantida da versão anterior.
|
||||||
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; frame-ancestors 'self';" always;
|
||||||
|
|
||||||
|
# --- Configurações de Compressão ---
|
||||||
|
brotli on;
|
||||||
|
brotli_comp_level 6;
|
||||||
|
brotli_types application/atom+xml application/javascript application/json application/rss+xml text/css text/javascript text/plain text/xml image/svg+xml;
|
||||||
|
gzip on;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
gzip_proxied any;
|
||||||
|
gzip_types application/atom+xml application/javascript application/json application/rss+xml text/css text/javascript text/plain text/xml image/svg+xml;
|
||||||
|
|
||||||
|
# --- Parâmetros de Proxy Otimizados para Zabbix ---
|
||||||
|
proxy_set_header Host $http_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_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_connect_timeout 90s;
|
||||||
|
proxy_send_timeout 90s;
|
||||||
|
proxy_read_timeout 90s;
|
||||||
|
proxy_buffers 8 16k;
|
||||||
|
proxy_buffer_size 32k;
|
||||||
|
|
||||||
|
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
|
||||||
|
|
||||||
|
# 1. Rota para assets estáticos (CACHE AGRESSIVO de NGINX e Navegador)
|
||||||
|
location ~* \.(?:css|js|mjs|svg|gif|png|jpg|jpeg|ico|wasm|woff2?|ttf|eot)$ {
|
||||||
|
proxy_pass http://zabbix_backend;
|
||||||
|
|
||||||
|
proxy_cache zabbix_cache;
|
||||||
|
proxy_cache_valid 200 7d;
|
||||||
|
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
|
||||||
|
add_header X-Proxy-Cache $upstream_cache_status;
|
||||||
|
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
# 2. Rota principal para a aplicação (SEM CACHE)
|
||||||
|
location / {
|
||||||
|
proxy_pass http://zabbix_backend;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue