[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-24 20:34:15

This commit is contained in:
srvproxy001.itguys.com.br 2025-09-24 20:34:15 -03:00
parent 100d52dc81
commit a980ad55a1
1 changed files with 0 additions and 108 deletions

View File

@ -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;
}