[Auto-Sync] Atualização das configurações em srvproxy001.itguys.com.br - 2025-09-21 06:56:52

This commit is contained in:
srvproxy001.itguys.com.br 2025-09-21 06:56:53 -03:00
parent 01aa4ae8c0
commit 31eaa9d51a
1 changed files with 24 additions and 28 deletions

View File

@ -43,6 +43,9 @@ server {
} }
} }
# ==============================================================================
# BLOCO 2: Servidor Principal - Proxy Reverso para Gitea (HTTPS)
# ==============================================================================
# ============================================================================== # ==============================================================================
# BLOCO 2: Servidor Principal - Proxy Reverso para Gitea (HTTPS) # BLOCO 2: Servidor Principal - Proxy Reverso para Gitea (HTTPS)
# ============================================================================== # ==============================================================================
@ -52,8 +55,6 @@ server {
server_name git.itguys.com.br; server_name git.itguys.com.br;
# --- CONFIGURAÇÃO CRÍTICA PARA GITEA --- # --- CONFIGURAÇÃO CRÍTICA PARA GITEA ---
# Permite pushes/uploads de até 10 GB. Ajuste conforme necessário.
# A ausência desta linha causa erros "413 Request Entity Too Large".
client_max_body_size 10G; client_max_body_size 10G;
# --- CONFIGURAÇÕES DE SSL --- # --- CONFIGURAÇÕES DE SSL ---
@ -64,49 +65,44 @@ server {
# --- CABEÇALHOS DE SEGURANÇA --- # --- CABEÇALHOS DE SEGURANÇA ---
add_header X-Content-Type-Options "nosniff" always; add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Frame-Options "SAMEORIGIN" always;
# Gitea define sua própria CSP, não adicione uma aqui a menos que saiba o que está a fazer.
# --- LOGS --- # --- LOGS ---
access_log /var/log/nginx/git.itguys.com.br.access.log; access_log /var/log/nginx/git.itguys.com.br.access.log;
error_log /var/log/nginx/git.itguys.com.br.error.log warn; error_log /var/log/nginx/git.itguys.com.br.error.log warn;
# --- PARÂMETROS DE PROXY GLOBAIS --- # --- PARÂMETROS DE PROXY GLOBAIS ---
# Define o destino e os cabeçalhos padrão para TODAS as locations.
include /etc/nginx/snippets/proxy_params.conf; include /etc/nginx/snippets/proxy_params.conf;
# --- REGRAS DE ROTEAMENTO (LOCATIONS) --- # --- REGRAS DE ROTEAMENTO (LOCATIONS) ---
# 1. Rota para operações Git (sem cache, timeouts longos). # 1. Rota para operações Git.
# Este bloco é crucial para que `git clone/pull/push` funcionem com repositórios grandes.
location ~ /.*/(git-upload-pack|git-receive-pack|info/refs|HEAD|objects) { location ~ /.*/(git-upload-pack|git-receive-pack|info/refs|HEAD|objects) {
# Timeouts longos para suportar operações demoradas.
proxy_read_timeout 3600s; proxy_read_timeout 3600s;
proxy_send_timeout 3600s; proxy_send_timeout 3600s;
# Buffering desativado para streaming de dados do Git.
proxy_buffering off; proxy_buffering off;
proxy_request_buffering off; proxy_request_buffering off;
}
# 2. Rota para assets estáticos da UI (cache agressivo).
location ~* \.(?:css|js|svg|png|jpg|jpeg|ico|woff2?|ttf)$ {
# Ativa o cache e a resiliência APENAS para estes arquivos.
proxy_cache gitea_cache;
proxy_cache_valid 200 1d; # Cache de 1 dia para assets.
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
add_header X-Proxy-Cache $upstream_cache_status;
}
# 3. Rota principal para a UI do Gitea (sem cache, com WebSockets).
location / {
# Cabeçalhos específicos para habilitar WebSockets (notificações em tempo real na UI).
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://gitea_backend; proxy_pass http://gitea_backend;
} }
# --- OUTRAS CONFIGURAÇÕES --- # 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/custom_errors.conf;
include /etc/nginx/snippets/global_robots.conf; include /etc/nginx/snippets/global_robots.conf;
} }