From a980ad55a1ed9c5277b4abfb671a29d7f773ac24 Mon Sep 17 00:00:00 2001 From: "srvproxy001.itguys.com.br" Date: Wed, 24 Sep 2025 20:34:15 -0300 Subject: [PATCH] =?UTF-8?q?[Auto-Sync]=20Atualiza=C3=A7=C3=A3o=20das=20con?= =?UTF-8?q?figura=C3=A7=C3=B5es=20em=20srvproxy001.itguys.com.br=20-=20202?= =?UTF-8?q?5-09-24=2020:34:15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nginx/sites-available/git.itguys.com.br.conf | 108 ------------------- 1 file changed, 108 deletions(-) delete mode 100644 nginx/sites-available/git.itguys.com.br.conf diff --git a/nginx/sites-available/git.itguys.com.br.conf b/nginx/sites-available/git.itguys.com.br.conf deleted file mode 100644 index 656e4ea..0000000 --- a/nginx/sites-available/git.itguys.com.br.conf +++ /dev/null @@ -1,108 +0,0 @@ -# ============================================================================== -# ARQUIVO: /etc/nginx/sites-available/git.itguys.com.br.conf -# AUTOR: Gemini (Especialista NGINX) -# DATA: 21/09/2025 -# -# DESCRIÇÃO: -# Configuração de Proxy Reverso OTIMIZADA e SEGURA para Gitea. -# -# MELHORIAS IMPLEMENTADAS: -# - Bloco `upstream`: Centraliza a definição do backend do Gitea. -# - `client_max_body_size`: Essencial para permitir grandes pushes e uploads. -# - Centralização de `proxy_params`: Evita repetição de código. -# - Estratégia de Cache Explícita: Cache é ativado APENAS para assets estáticos. -# - Tratamento Especializado: Mantém timeouts longos e buffering desativado -# para operações Git, e suporte a WebSocket para a UI. -# - Cabeçalhos de Segurança: Adicionados para reforçar a proteção. -# -# A FAZER: -# - Certifique-se de que a zona de cache `gitea_cache` está definida no seu -# arquivo principal `/etc/nginx/nginx.conf`. -# Ex: proxy_cache_path /var/cache/nginx/gitea_cache levels=1:2 keys_zone=gitea_cache:10m ... -# ============================================================================== - -# Define o nosso servidor Gitea como um "upstream" para fácil referência. -upstream gitea_backend { - server 10.10.253.128; -} - -# ============================================================================== -# BLOCO 1: Redirecionamento de HTTP (porta 80) para HTTPS -# ============================================================================== -server { - listen 80; - listen [::]:80; - server_name git.itguys.com.br; - - location /.well-known/acme-challenge/ { - root /var/www/html; - } - - location / { - return 301 https://$host$request_uri; - } -} - -# ============================================================================== -# BLOCO 2: Servidor Principal - Proxy Reverso para Gitea (HTTPS) -# ============================================================================== -# ============================================================================== -# BLOCO 2: Servidor Principal - Proxy Reverso para Gitea (HTTPS) -# ============================================================================== -server { - listen 443 ssl http2; - listen [::]:443 ssl http2; - server_name git.itguys.com.br; - - # --- CONFIGURAÇÃO CRÍTICA PARA GITEA --- - client_max_body_size 10G; - - # --- CONFIGURAÇÕES DE SSL --- - ssl_certificate /etc/letsencrypt/live/git.itguys.com.br/fullchain.pem; # managed by Certbot - ssl_certificate_key /etc/letsencrypt/live/git.itguys.com.br/privkey.pem; # managed by Certbot - include /etc/nginx/snippets/ssl_params.conf; # Kit de segurança SSL. - - # --- CABEÇALHOS DE SEGURANÇA --- - add_header X-Content-Type-Options "nosniff" always; - add_header X-Frame-Options "SAMEORIGIN" always; - - # --- LOGS --- - access_log /var/log/nginx/git.itguys.com.br.access.log; - error_log /var/log/nginx/git.itguys.com.br.error.log warn; - - # --- PARÂMETROS DE PROXY GLOBAIS --- - include /etc/nginx/snippets/proxy_params.conf; - - # --- REGRAS DE ROTEAMENTO (LOCATIONS) --- - - # 1. Rota para operações Git. - location ~ /.*/(git-upload-pack|git-receive-pack|info/refs|HEAD|objects) { - proxy_read_timeout 3600s; - proxy_send_timeout 3600s; - proxy_buffering off; - proxy_request_buffering off; - proxy_pass http://gitea_backend; - } - - # 2. Rota principal para a UI, que também lida com WebSockets e assets. - location / { - # --- Configurações de Cache (Aplicadas aqui para todos os requests) --- - # A lógica do cache deve vir antes do proxy_pass para ser a primeira a ser avaliada. - proxy_cache gitea_cache; - proxy_cache_valid 200 1d; - proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504; - add_header X-Proxy-Cache $upstream_cache_status; - - # --- Parâmetros para WebSockets (Gitea UI) --- - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - - # --- Proxy Pass final --- - proxy_pass http://gitea_backend; - } - - # ... Outras inclusões de snippets - include /etc/nginx/snippets/custom_errors.conf; - include /etc/nginx/snippets/global_robots.conf; -}