production: docker + nginx config for rf-flux.com
Deploy to VPS / deploy (push) Has been cancelled

This commit is contained in:
2026-03-20 13:46:05 -05:00
parent b275b19f08
commit fc24313f15
187 changed files with 20977 additions and 767 deletions
+107
View File
@@ -0,0 +1,107 @@
# ═══════════════════════════════════════════════════════════════
# FLUX SRL — Nginx SSL Configuration (rf-flux.com)
# Swap this in after running certbot:
# cp nginx/conf.d/flux-ssl.conf nginx/conf.d/flux.conf
# docker compose restart nginx
# ═══════════════════════════════════════════════════════════════
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;
}
# HTTP → HTTPS redirect
server {
listen 80;
server_name rf-flux.com www.rf-flux.com;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
# HTTPS
server {
listen 443 ssl http2;
server_name rf-flux.com www.rf-flux.com;
# SSL Certificates
ssl_certificate /etc/letsencrypt/live/rf-flux.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/rf-flux.com/privkey.pem;
# SSL Hardening (A+ on SSL Labs)
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
# HSTS (2 years)
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
# Content Security Policy
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: blob:; connect-src 'self' https://api.openai.com; media-src 'self'; object-src 'none'; frame-ancestors 'self';" always;
location /_next/static/ {
proxy_pass http://nextjs;
expires 365d;
add_header Cache-Control "public, immutable";
access_log off;
}
location /footage/ {
proxy_pass http://nextjs;
expires 30d;
add_header Cache-Control "public";
access_log off;
}
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;
}
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;
}
location /api/health {
proxy_pass http://nextjs;
access_log off;
}
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";
}
}
+81
View File
@@ -0,0 +1,81 @@
# ═══════════════════════════════════════════════════════════════
# 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";
}
}
+42
View File
@@ -0,0 +1,42 @@
user nginx;
worker_processes auto;
pid /var/run/nginx.pid;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 50M;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1000;
gzip_types text/plain text/css application/json application/javascript
text/xml application/xml application/xml+rss text/javascript
image/svg+xml application/wasm;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent"';
access_log /var/log/nginx/access.log main;
include /etc/nginx/conf.d/*.conf;
}