[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-27 22:52:29
This commit is contained in:
parent
fcf46f5e38
commit
1c0fc7eff1
|
|
@ -1,99 +0,0 @@
|
||||||
# ==============================================================================
|
|
||||||
# ARQUIVO: /etc/nginx/sites-available/zammad.itguys.com.br.conf
|
|
||||||
# AUTOR: Gemini (Especialista NGINX)
|
|
||||||
# DATA: 21/09/2025
|
|
||||||
#
|
|
||||||
# DESCRIÇÃO:
|
|
||||||
# Configuração de Proxy Reverso OTIMIZADA e SEGURA para Zammad.
|
|
||||||
#
|
|
||||||
# FUNCIONALIDADES:
|
|
||||||
# - Múltiplos Upstreams: Um para a aplicação web e outro para o WebSocket.
|
|
||||||
# - Redirecionamento canónico forçado para HTTPS.
|
|
||||||
# - Restrição de Acesso à rede interna.
|
|
||||||
# - Suporte a WebSockets para a interface em tempo real (/ws).
|
|
||||||
# - Cache ativado apenas para os assets estáticos (/assets/).
|
|
||||||
# ==============================================================================
|
|
||||||
|
|
||||||
# Define o backend principal da aplicação Zammad.
|
|
||||||
upstream zammad_backend {
|
|
||||||
server 172.16.254.59;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Define o backend específico para o serviço de WebSocket do Zammad.
|
|
||||||
upstream zammad_websocket_backend {
|
|
||||||
server 172.16.254.59:6042;
|
|
||||||
}
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# BLOCO 1: Redirecionamento de HTTP (porta 80) para HTTPS
|
|
||||||
# ==============================================================================
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
listen [::]:80;
|
|
||||||
server_name zammad.itguys.com.br;
|
|
||||||
|
|
||||||
# Permite a validação do Let's Encrypt.
|
|
||||||
location /.well-known/acme-challenge/ {
|
|
||||||
root /var/www/html;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Redireciona todo o tráfego para a versão segura.
|
|
||||||
location / {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# BLOCO 2: Servidor Principal - Proxy Reverso para Zammad (HTTPS)
|
|
||||||
# ==============================================================================
|
|
||||||
server {
|
|
||||||
listen 443 ssl http2;
|
|
||||||
listen [::]:443 ssl http2;
|
|
||||||
server_name zammad.itguys.com.br;
|
|
||||||
|
|
||||||
# --- CONFIGURAÇÕES DE SSL E SEGURANÇA ---
|
|
||||||
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
|
|
||||||
include /etc/nginx/snippets/ssl_params.conf;
|
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
||||||
|
|
||||||
# --- POLÍTICAS DE ACESSO E LOGS ---
|
|
||||||
include /etc/nginx/snippets/internal_networks.conf;
|
|
||||||
include /etc/nginx/snippets/global_robots.conf;
|
|
||||||
access_log /var/log/nginx/zammad.itguys.com.br.access.log;
|
|
||||||
error_log /var/log/nginx/zammad.itguys.com.br.error.log warn;
|
|
||||||
|
|
||||||
# --- PARÂMETROS GLOBAIS ---
|
|
||||||
client_max_body_size 50M; # Permite anexos grandes
|
|
||||||
include /etc/nginx/snippets/proxy_params.conf;
|
|
||||||
|
|
||||||
# --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
|
|
||||||
|
|
||||||
# 1. Rota para assets estáticos (CACHE AGRESSIVO)
|
|
||||||
location /assets/ {
|
|
||||||
proxy_cache zammad_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;
|
|
||||||
|
|
||||||
proxy_pass http://zammad_backend;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 2. Rota para WebSockets (SEM CACHE)
|
|
||||||
location /ws {
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
|
|
||||||
proxy_pass http://zammad_websocket_backend;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 3. Rota principal para a aplicação (SEM CACHE)
|
|
||||||
location / {
|
|
||||||
proxy_pass http://zammad_backend;
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Páginas de Erro Personalizadas ---
|
|
||||||
include /etc/nginx/snippets/custom_errors.conf;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue