[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-27 17:04:27

This commit is contained in:
srvproxy001.itguys.com.br 2025-09-27 17:04:27 -03:00
parent 9fd93f5d73
commit cb9e2aa0e4
1 changed files with 0 additions and 164 deletions

View File

@ -1,164 +0,0 @@
# ==============================================================================
# ARQUIVO: /etc/nginx/sites-available/itguys.com.br.conf
# AUTOR: Gemini (Especialista NGINX)
# DATA: 24/09/2025 - 21:35
# VERSÃO: 2.0 (Otimização para Performance, Segurança e SEO)
#
# DESCRIÇÃO:
# Configuração de Proxy Reverso OTIMIZADA para o site público itguys.com.br.
# Esta versão é autocontida (sem snippets), com foco em velocidade de
# carregamento e segurança reforçada.
#
# MELHORIAS IMPLEMENTADAS:
# - CONFIGURAÇÃO AUTOCONTIDA: Diretivas de SSL e proxy foram internalizadas.
# - COMPRESSÃO AVANÇADA: Adicionado Brotli e Gzip para reduzir o tamanho dos
# arquivos e acelerar o carregamento.
# - SEGURANÇA REFORÇADA: Implementado conjunto completo de cabeçalhos de
# segurança, incluindo HSTS e uma CSP básica para sites estáticos.
# - OTIMIZAÇÃO DE SSL/TLS: Utiliza protocolos e cifras modernos e seguros.
# - CACHE OTIMIZADO: Define cache agressivo no navegador para assets estáticos.
# - SEO: Garante que o site seja acessível para robôs de busca.
# ==============================================================================
# Define o nosso servidor web como um "upstream" para fácil referência.
upstream itguys_backend {
server 172.16.12.17:80;
}
# ==============================================================================
# BLOCO 1: Redirecionamento de HTTP (porta 80) para HTTPS com WWW
# ==============================================================================
server {
listen 80;
listen [::]:80;
server_name itguys.com.br www.itguys.com.br;
location /.well-known/acme-challenge/ {
root /var/www/html;
}
location / {
return 301 https://www.itguys.com.br$request_uri;
}
}
# ==============================================================================
# BLOCO 2: Redirecionamento de HTTPS SEM WWW para a versão COM WWW
# ==============================================================================
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name itguys.com.br;
ssl_certificate /etc/letsencrypt/live/www.itguys.com.br/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.itguys.com.br/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.itguys.com.br/fullchain.pem;
# Apenas redireciona, não precisa de mais nada aqui.
return 301 https://www.itguys.com.br$request_uri;
}
# ==============================================================================
# BLOCO 3: Servidor Principal - Proxy Reverso (HTTPS COM WWW)
# ==============================================================================
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.itguys.com.br;
# --- LOGS ---
access_log /var/log/nginx/itguys.com.br.access.log;
error_log /var/log/nginx/itguys.com.br.error.log warn;
# =================================================================
# INÍCIO: Configurações de SSL/TLS
# =================================================================
ssl_certificate /etc/letsencrypt/live/www.itguys.com.br/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.itguys.com.br/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.itguys.com.br/fullchain.pem;
ssl_session_timeout 1d;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384';
ssl_stapling on;
ssl_stapling_verify on;
# =================================================================
# FIM: Configurações de SSL/TLS
# =================================================================
# =================================================================
# INÍCIO: Cabeçalhos de Segurança e SEO
# =================================================================
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
# CSP para um site estático/simples.
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' https://www.googletagmanager.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; frame-ancestors 'self';" always;
# =================================================================
# FIM: Cabeçalhos de Segurança e SEO
# =================================================================
# =================================================================
# INÍCIO: Configurações de Compressão Brotli & Gzip
# =================================================================
brotli on;
brotli_comp_level 6;
brotli_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
gzip_disable "MSIE [1-6]\.";
# =================================================================
# FIM: Configurações de Compressão
# =================================================================
# --- PARÂMETROS DE PROXY GLOBAIS ---
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;
# --- ESTRATÉGIA DE CACHE ---
proxy_cache itguys_cache;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
add_header X-Proxy-Cache $upstream_cache_status;
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
# Para SEO, permitir que todos os robôs visitem.
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "User-agent: *\nAllow: /\n";
}
# 1. Localização para o formulário (SEM CACHE)
location = /php/enviar.php {
proxy_no_cache 1;
proxy_cache_bypass 1;
proxy_pass http://itguys_backend;
}
# 2. Localização para assets estáticos (CACHE AGRESSIVO)
location ~* \.(jpg|jpeg|gif|png|webp|svg|css|js|ico|woff2?|ttf|json)$ {
expires 1y;
add_header Cache-Control "public, immutable";
proxy_cache_valid 200 30d;
proxy_pass http://itguys_backend;
access_log off;
}
# 3. Localização para páginas HTML (CACHE CURTO)
# Apanha o index.html, Sobre.html, Serviços.html, etc.
location / {
expires 10m; # Cache de navegador curto para HTML
proxy_cache_valid 200 10m;
proxy_pass http://itguys_backend;
}
}