go integration and wikipedia

This commit is contained in:
jlimolina 2026-03-28 18:30:07 +01:00
parent 47a252e339
commit ee90335b92
7828 changed files with 1307913 additions and 20807 deletions

View file

@ -4,8 +4,8 @@ error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 4096; # Alta capacidad de conexiones concurrentes
use epoll; # Mejor rendimiento en Linux
worker_connections 2048;
use epoll;
}
http {
@ -18,91 +18,76 @@ http {
access_log /var/log/nginx/access.log main;
# Optimizaciones de rendimiento
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 1000M;
client_max_body_size 100M;
# Compresión gzip para reducir ancho de banda
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml text/javascript
application/json application/javascript application/xml+rss
application/atom+xml image/svg+xml;
gzip_disable "msie6";
gzip_types text/plain text/css text/javascript
application/json application/javascript
application/xml text/xml;
# Cache de archivos estáticos
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
# Configuración upstream para Gunicorn
upstream gunicorn_backend {
server rss2_web:8000 max_fails=3 fail_timeout=30s;
# Upstream for Go API
upstream api_backend {
server backend-go:8080;
keepalive 32;
}
# Upstream for React Frontend
upstream frontend {
server rss2_frontend:80;
keepalive 16;
}
server {
listen 80;
server_name _;
# Logs específicos
access_log /var/log/nginx/rss2_access.log main;
error_log /var/log/nginx/rss2_error.log warn;
# Límites de seguridad
client_body_timeout 60s;
client_header_timeout 60s;
send_timeout 300s;
# Servir archivos estáticos directamente desde NGINX
location /static/ {
alias /app/static/;
expires 7d;
add_header Cache-Control "no-cache, must-revalidate";
access_log on;
}
# Proxy pass a Gunicorn para todo lo demás
# Serve React Frontend
location / {
proxy_pass http://gunicorn_backend;
proxy_redirect off;
# Headers necesarios
proxy_pass http://frontend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $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;
# Timeouts para queries lentas
proxy_cache_bypass $http_upgrade;
}
# Proxy to Go API
location /api/ {
proxy_pass http://api_backend/api/;
proxy_http_version 1.1;
proxy_set_header Host $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;
proxy_set_header Connection "";
proxy_connect_timeout 60s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
# Buffering
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 4k;
proxy_busy_buffers_size 8k;
# HTTP/1.1 para keepalive
proxy_http_version 1.1;
proxy_set_header Connection "";
}
# Health check endpoint
# Health check
location /health {
access_log off;
proxy_pass http://gunicorn_backend;
return 200 "ok";
}
# Bloquear acceso a archivos sensibles
# Block sensitive files
location ~ /\. {
deny all;
access_log off;