2026-06-19 11:28:04 +03:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name _;
|
2026-06-20 19:13:05 +03:00
|
|
|
|
2026-06-19 11:28:04 +03:00
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
2026-06-20 22:21:47 +03:00
|
|
|
# Gzip for text assets
|
|
|
|
|
gzip on;
|
|
|
|
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
|
|
|
|
gzip_min_length 1024;
|
|
|
|
|
|
|
|
|
|
# SPA fallback — must be before /api/ location
|
2026-06-19 11:28:04 +03:00
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
|
}
|
|
|
|
|
|
2026-06-20 22:21:47 +03:00
|
|
|
# API + SSE — proxy to backend container
|
2026-06-19 11:28:04 +03:00
|
|
|
location /api/ {
|
|
|
|
|
proxy_pass http://backend:8000;
|
2026-06-20 19:13:05 +03:00
|
|
|
proxy_http_version 1.1;
|
2026-06-19 11:28:04 +03:00
|
|
|
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;
|
2026-06-20 19:13:05 +03:00
|
|
|
|
2026-06-20 22:21:47 +03:00
|
|
|
# SSE: disable buffering, extend timeouts for long-running streams
|
2026-06-19 11:28:04 +03:00
|
|
|
proxy_buffering off;
|
|
|
|
|
proxy_cache off;
|
2026-06-20 22:21:47 +03:00
|
|
|
proxy_read_timeout 600s;
|
|
|
|
|
proxy_send_timeout 600s;
|
|
|
|
|
|
|
|
|
|
# WebSocket support (in case of future upgrade)
|
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection "upgrade";
|
2026-06-20 19:13:05 +03:00
|
|
|
}
|
|
|
|
|
|
2026-06-20 22:21:47 +03:00
|
|
|
# Static assets (icons, uploads) served by backend
|
2026-06-20 19:13:05 +03:00
|
|
|
location /static/ {
|
|
|
|
|
proxy_pass http://backend:8000;
|
2026-06-20 22:21:47 +03:00
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Health-check passthrough
|
|
|
|
|
location = /health {
|
|
|
|
|
proxy_pass http://backend:8000/api/health;
|
2026-06-19 11:28:04 +03:00
|
|
|
}
|
|
|
|
|
}
|