[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-16 10:22:54
This commit is contained in:
parent
ba5f8ba661
commit
51df8b3be1
|
|
@ -1,95 +0,0 @@
|
||||||
# Ficheiro: /etc/nginx/sites-available/zammad.itguys.com.br.conf
|
|
||||||
#
|
|
||||||
# Configuração de Proxy Reverso com cache HÍBRIDO e suporte a WebSockets,
|
|
||||||
# otimizada especificamente para o Zammad.
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# BLOCO HTTP: Redirecionar para HTTPS
|
|
||||||
# ==============================================================================
|
|
||||||
server {
|
|
||||||
if ($host = zammad.itguys.com.br) {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
} # managed by Certbot
|
|
||||||
|
|
||||||
|
|
||||||
listen 80;
|
|
||||||
listen [::]:80;
|
|
||||||
server_name zammad.itguys.com.br;
|
|
||||||
location /.well-known/acme-challenge/ { root /var/www/html; }
|
|
||||||
location / { return 301 https://$host$request_uri; }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# BLOCO HTTPS: O Coração da nossa Configuração
|
|
||||||
# ==============================================================================
|
|
||||||
server {
|
|
||||||
listen 443 ssl http2;
|
|
||||||
listen [::]:443 ssl http2;
|
|
||||||
server_name zammad.itguys.com.br;
|
|
||||||
|
|
||||||
# Certificados SSL (Geridos pelo Certbot)
|
|
||||||
#ssl_certificate /etc/letsencrypt/live/zammad.itguys.com.br/fullchain.pem;
|
|
||||||
#ssl_certificate_key /etc/letsencrypt/live/zammad.itguys.com.br/privkey.pem;
|
|
||||||
|
|
||||||
# Cabeçalhos de Segurança Padrão
|
|
||||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
|
||||||
|
|
||||||
# Configurações de Log
|
|
||||||
access_log /var/log/nginx/access.log detailed_proxy;
|
|
||||||
error_log /var/log/nginx/error.log;
|
|
||||||
|
|
||||||
# Aumenta o tamanho máximo do corpo da requisição para permitir anexos grandes.
|
|
||||||
client_max_body_size 50M;
|
|
||||||
|
|
||||||
# --- CABEÇALHOS DE PROXY GLOBAIS ---
|
|
||||||
# Estes cabeçalhos serão herdados por TODAS as 'location' abaixo.
|
|
||||||
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 HÍBRIDA ---
|
|
||||||
proxy_cache zammad_cache; # Recomendado criar uma zona de cache dedicada 'zammad_cache' no nginx.conf
|
|
||||||
add_header X-Proxy-Cache $upstream_cache_status;
|
|
||||||
proxy_no_cache 1; # Regra geral: NÃO cachear por defeito.
|
|
||||||
proxy_cache_bypass 1;
|
|
||||||
|
|
||||||
# --- LOCALIZAÇÃO PARA FICHEIROS ESTÁTICOS (CACHE ATIVADO) ---
|
|
||||||
# O Zammad serve os seus ficheiros estáticos a partir do caminho /assets/
|
|
||||||
location /assets/ {
|
|
||||||
# Ativa o cache para estes ficheiros.
|
|
||||||
proxy_no_cache 0;
|
|
||||||
proxy_cache_bypass 0;
|
|
||||||
proxy_cache_valid 200 60m;
|
|
||||||
expires 7d; # Instrui o navegador a guardar uma cópia por 7 dias.
|
|
||||||
|
|
||||||
proxy_pass http://172.16.254.59;
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- LOCALIZAÇÃO PARA WEBSOCKETS (SEM CACHE E HEADERS ESPECIAIS) ---
|
|
||||||
# Esta regra captura a URL /ws que vimos a falhar no log do F12.
|
|
||||||
location /ws {
|
|
||||||
# Cabeçalhos essenciais para "promover" a conexão para WebSocket.
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
|
|
||||||
# Desativa o buffering para que os dados fluam em tempo real.
|
|
||||||
proxy_buffering off;
|
|
||||||
|
|
||||||
proxy_pass http://172.16.254.59;
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- LOCALIZAÇÃO PRINCIPAL PARA A APLICAÇÃO (SEM CACHE) ---
|
|
||||||
# Esta regra apanha todo o resto do tráfego (páginas, APIs, ficheiros JSON dinâmicos).
|
|
||||||
location / {
|
|
||||||
# O cache permanece desativado aqui por herdar da regra geral.
|
|
||||||
proxy_pass http://172.16.254.59;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/zammad.itguys.com.br/fullchain.pem; # managed by Certbot
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/zammad.itguys.com.br/privkey.pem; # managed by Certbot
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue