llm-gateway/deploy/nginx.conf
Rene Fichtmueller 3a00ff4d33 feat: initial llm-gateway implementation
- Complete Fastify gateway with 8-stage pipeline
- Circuit breaker (opossum) per model tier
- Rate limiting per caller
- Ban list validation (EN/DE/auto-detected)
- TIP validator (SFF-8024, part numbers, wavelengths)
- Prometheus metrics
- pg-boss async queue
- PostgreSQL audit log + review queue
- 9 prompt templates (TIP, LinkedIn, ShieldX)
- Learning engine scaffolding
- Auto-learning: ban-list, few-shot, routing, prompt optimizer
2026-04-02 22:48:55 +02:00

54 lines
1.5 KiB
Nginx Configuration File

# Nginx reverse proxy for LLM Gateway
# Place at: /etc/nginx/sites-available/llm-gateway
# Enable: ln -s /etc/nginx/sites-available/llm-gateway /etc/nginx/sites-enabled/
# Reload: nginx -t && systemctl reload nginx
#
# NOTE: If using Cloudflare Tunnel, nginx is optional.
# The tunnel connects directly to localhost:3100.
upstream llm_gateway {
server localhost:3100;
keepalive 32;
}
server {
listen 80;
server_name llm-gateway.context-x.org;
# Security headers
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
# Don't leak nginx version
server_tokens off;
location / {
proxy_pass http://llm_gateway;
# Timeouts: 130s to handle large LLM responses without proxy interruption
proxy_read_timeout 130s;
proxy_connect_timeout 10s;
proxy_send_timeout 130s;
# Standard proxy headers
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;
# Keep-alive to upstream
proxy_http_version 1.1;
proxy_set_header Connection "";
# Buffer streaming responses (LLMs can stream tokens)
proxy_buffering off;
}
# Health endpoint — no logging (noisy in monitoring)
location /health {
proxy_pass http://llm_gateway/health;
access_log off;
}
}