[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-24 21:37:39
This commit is contained in:
parent
b39f9a8b4f
commit
04deb7a719
|
|
@ -1,114 +0,0 @@
|
|||
# ==============================================================================
|
||||
# ARQUIVO: /etc/nginx/sites-available/itguys.com.br.conf
|
||||
# AUTOR: Gemini (Especialista NGINX)
|
||||
# DATA: 21/09/2025
|
||||
#
|
||||
# DESCRIÇÃO:
|
||||
# Configuração de Proxy Reverso OTIMIZADA para o site principal itguys.com.br.
|
||||
# Esta versão mantém as URLs originais com a extensão .html.
|
||||
#
|
||||
# FUNCIONALIDADES:
|
||||
# - Redirecionamento canónico forçado para https://www.itguys.com.br.
|
||||
# - Estratégia de Cache Otimizada: Cache agressivo para assets, específico para
|
||||
# páginas HTML importantes, e sem cache para o formulário PHP.
|
||||
# - Bloco `upstream` para fácil manutenção do backend.
|
||||
# - Cabeçalhos de segurança reforçados.
|
||||
# ==============================================================================
|
||||
|
||||
# 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; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/www.itguys.com.br/privkey.pem; # managed by Certbot
|
||||
include /etc/nginx/snippets/ssl_params.conf;
|
||||
|
||||
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;
|
||||
|
||||
# --- CONFIGURAÇÕES DE SSL E SEGURANÇA ---
|
||||
ssl_certificate /etc/letsencrypt/live/www.itguys.com.br/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/www.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;
|
||||
|
||||
# --- LOGS ---
|
||||
access_log /var/log/nginx/itguys.com.br.access.log;
|
||||
error_log /var/log/nginx/itguys.com.br.error.log warn;
|
||||
|
||||
# --- PARÂMETROS DE PROXY GLOBAIS ---
|
||||
include /etc/nginx/snippets/proxy_params.conf;
|
||||
|
||||
# --- 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) ---
|
||||
|
||||
# 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)$ {
|
||||
proxy_cache_valid 200 30d;
|
||||
proxy_pass http://itguys_backend;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
# 3. Localização para páginas HTML específicas (CACHE LONGO)
|
||||
# Mantém sua lógica original de cache diferenciado para estas páginas.
|
||||
# Recomendo usar nomes em minúsculo: (?:sobre|servicos)\.html$
|
||||
location ~* ^/(Sobre|Serviços)\.html$ {
|
||||
proxy_cache_valid 200 1h;
|
||||
proxy_pass http://itguys_backend;
|
||||
}
|
||||
|
||||
# 4. Localização principal para o resto do site (CACHE CURTO)
|
||||
# Apanha o index.html e qualquer outra página não definida acima.
|
||||
location / {
|
||||
proxy_cache_valid 200 10m;
|
||||
proxy_pass http://itguys_backend;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue