[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-21 03:34:47
This commit is contained in:
parent
5c3c2318ce
commit
2b2a75b93d
|
|
@ -1,114 +0,0 @@
|
||||||
# Ficheiro: /etc/nginx/sites-available/itguys.com.br.conf
|
|
||||||
#
|
|
||||||
# Configuração de Proxy Reverso OTIMIZADA com redirecionamento canónico
|
|
||||||
# para o site itguys.com.br. Esta versão usa snippets para a máxima
|
|
||||||
# consistência e permite a indexação por motores de busca.
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# BLOCO 1: Redirecionar todo o tráfego da porta 80 para a versão segura COM WWW
|
|
||||||
# ==============================================================================
|
|
||||||
server {
|
|
||||||
if ($host = itguys.com.br) {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
} # managed by Certbot
|
|
||||||
|
|
||||||
|
|
||||||
if ($host = www.itguys.com.br) {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
} # managed by Certbot
|
|
||||||
|
|
||||||
|
|
||||||
listen 80;
|
|
||||||
listen [::]:80;
|
|
||||||
server_name itguys.com.br www.itguys.com.br;
|
|
||||||
include /etc/nginx/snippets/custom_errors.conf; # Carrega as páginas de erro personalizadas
|
|
||||||
|
|
||||||
location /.well-known/acme-challenge/ {
|
|
||||||
root /var/www/html;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
return 301 https://www.itguys.com.br$request_uri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# BLOCO 2: Redirecionar o tráfego HTTPS SEM WWW para a versão COM WWW
|
|
||||||
# ==============================================================================
|
|
||||||
server {
|
|
||||||
listen 443 ssl http2;
|
|
||||||
listen [::]:443 ssl http2;
|
|
||||||
server_name itguys.com.br;
|
|
||||||
include /etc/nginx/snippets/custom_errors.conf; # Carrega as páginas de erro personalizadas
|
|
||||||
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
|
|
||||||
ssl_trusted_certificate /etc/letsencrypt/live/www.itguys.com.br/fullchain.pem;
|
|
||||||
|
|
||||||
return 301 https://www.itguys.com.br$request_uri;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# BLOCO 3: O SERVIDOR PRINCIPAL E CANÓNICO (HTTPS COM WWW)
|
|
||||||
# ==============================================================================
|
|
||||||
server {
|
|
||||||
listen 443 ssl http2;
|
|
||||||
listen [::]:443 ssl http2;
|
|
||||||
server_name www.itguys.com.br;
|
|
||||||
include /etc/nginx/snippets/custom_errors.conf; # Carrega as páginas de erro personalizadas
|
|
||||||
|
|
||||||
# --- Certificados e Segurança ---
|
|
||||||
#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;
|
|
||||||
include /etc/nginx/snippets/ssl_params.conf;
|
|
||||||
|
|
||||||
# --- Políticas de Acesso e Logs ---
|
|
||||||
# NÃO incluímos o robots_block_all.conf aqui para permitir a indexação pelo Google.
|
|
||||||
# O ficheiro robots.txt deve ser gerido pelo servidor de backend.
|
|
||||||
access_log /var/log/nginx/access.log detailed_proxy;
|
|
||||||
error_log /var/log/nginx/error.log;
|
|
||||||
|
|
||||||
# --- ESTRATÉGIA DE CACHE HÍBRIDA ---
|
|
||||||
proxy_cache zabbix_cache;
|
|
||||||
add_header X-Proxy-Cache $upstream_cache_status;
|
|
||||||
proxy_no_cache 1;
|
|
||||||
proxy_cache_bypass 1;
|
|
||||||
# Inclui os nossos cabeçalhos de proxy padrão (Host, X-Real-IP, etc.).
|
|
||||||
include /etc/nginx/snippets/proxy_params.conf;
|
|
||||||
|
|
||||||
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
|
|
||||||
|
|
||||||
# Localização para o formulário (sem cache)
|
|
||||||
location = /php/enviar.php {
|
|
||||||
proxy_no_cache 1;
|
|
||||||
proxy_cache_bypass 1;
|
|
||||||
proxy_pass http://172.16.12.17:80;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Localização para ficheiros estáticos (cache agressivo)
|
|
||||||
location ~* \.(jpg|jpeg|gif|png|webp|svg|css|js|ico|woff2|ttf|json)$ {
|
|
||||||
# Usa o nosso snippet de cache mais agressivo para a máxima performance.
|
|
||||||
include /etc/nginx/snippets/cache_static_assets.conf;
|
|
||||||
proxy_pass http://172.16.12.17:80;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Localização para páginas HTML estáticas (cache longo)
|
|
||||||
location ~* ^/(Sobre|Serviços)\.html$ {
|
|
||||||
proxy_no_cache 0;
|
|
||||||
proxy_cache_bypass 0;
|
|
||||||
proxy_cache_valid 200 1h;
|
|
||||||
proxy_pass http://172.16.12.17:80;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Localização principal para o resto do site (cache curto)
|
|
||||||
location / {
|
|
||||||
proxy_no_cache 0;
|
|
||||||
proxy_cache_bypass 0;
|
|
||||||
proxy_cache_valid 200 5m;
|
|
||||||
proxy_pass http://172.16.12.17:80;
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue