DavidHerran fc24313f15
Some checks failed
Deploy to VPS / deploy (push) Has been cancelled
production: docker + nginx config for rf-flux.com
2026-03-20 13:46:05 -05:00

82 lines
2.6 KiB
Plaintext

# ═══════════════════════════════════════════════════════════════
# FLUX SRL — Nginx Site Configuration
# Phase 1: HTTP only (SSL added after certbot runs)
# ═══════════════════════════════════════════════════════════════
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
limit_req_zone $binary_remote_addr zone=login:10m rate=3r/m;
upstream nextjs {
server app:3000;
keepalive 32;
}
server {
listen 80;
server_name rf-flux.com www.rf-flux.com;
# Let's Encrypt challenge (keep this even after SSL)
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
# Static assets: Next.js hashed (immutable cache)
location /_next/static/ {
proxy_pass http://nextjs;
expires 365d;
add_header Cache-Control "public, immutable";
access_log off;
}
# Static assets: footage, GLB models
location /footage/ {
proxy_pass http://nextjs;
expires 30d;
add_header Cache-Control "public";
access_log off;
}
# CMS Admin (strict rate limiting)
location /hq-command/ {
limit_req zone=login burst=5 nodelay;
proxy_pass http://nextjs;
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;
}
# FluxAI Chat API (streaming + rate limited)
location /api/chat {
limit_req zone=api burst=20 nodelay;
proxy_pass http://nextjs;
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_http_version 1.1;
proxy_set_header Connection '';
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 120s;
}
# Health check
location /api/health {
proxy_pass http://nextjs;
access_log off;
}
# Default
location / {
proxy_pass http://nextjs;
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_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}