2026-11-18 05:18:55 +06:00
|
|
|
map $http_upgrade $connection_upgrade {
|
|
|
|
|
default upgrade;
|
|
|
|
|
'' close;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map $http_x_forwarded_proto $forwarded_proto {
|
|
|
|
|
default $http_x_forwarded_proto;
|
|
|
|
|
'' $scheme;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map $http_x_forwarded_host $forwarded_host {
|
|
|
|
|
default $http_x_forwarded_host;
|
|
|
|
|
'' $host;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-23 11:43:49 -05:00
|
|
|
upstream nextjs_upstream {
|
|
|
|
|
server 127.0.0.1:3000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
upstream socketio_upstream {
|
|
|
|
|
server 127.0.0.1:4000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name _;
|
|
|
|
|
|
2026-11-21 22:15:32 +06:00
|
|
|
# Preserve real external visitor IP when routed behind trusted reverse proxies / Docker bridges
|
|
|
|
|
set_real_ip_from 127.0.0.1;
|
|
|
|
|
set_real_ip_from 10.0.0.0/8;
|
|
|
|
|
set_real_ip_from 172.16.0.0/12;
|
|
|
|
|
set_real_ip_from 192.168.0.0/16;
|
|
|
|
|
set_real_ip_from fc00::/7;
|
|
|
|
|
real_ip_header X-Forwarded-For;
|
|
|
|
|
real_ip_recursive on;
|
|
|
|
|
|
2026-10-23 11:43:49 -05:00
|
|
|
client_max_body_size 50M;
|
|
|
|
|
|
2026-11-18 05:42:19 +06:00
|
|
|
# Express + Socket.IO health endpoint on port 4000
|
|
|
|
|
location = /health {
|
|
|
|
|
proxy_pass http://socketio_upstream;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $forwarded_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 $forwarded_proto;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-23 11:43:49 -05:00
|
|
|
# Socket.IO WebSocket reverse proxy to port 4000
|
|
|
|
|
location /socket.io/ {
|
|
|
|
|
proxy_pass http://socketio_upstream;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
2026-11-18 05:18:55 +06:00
|
|
|
proxy_set_header Connection $connection_upgrade;
|
2026-10-23 11:43:49 -05:00
|
|
|
proxy_set_header Host $host;
|
2026-11-18 05:18:55 +06:00
|
|
|
proxy_set_header X-Forwarded-Host $forwarded_host;
|
2026-10-23 11:43:49 -05:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2026-11-18 05:18:55 +06:00
|
|
|
proxy_set_header X-Forwarded-Proto $forwarded_proto;
|
2026-11-19 20:22:01 +06:00
|
|
|
proxy_read_timeout 86400s;
|
|
|
|
|
proxy_send_timeout 86400s;
|
2026-11-21 22:15:32 +06:00
|
|
|
proxy_buffering off;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Admin Files Manager (CloudCmd + isolated Socket.IO) reverse proxy to port 4000
|
|
|
|
|
location /vcon/files-engine {
|
|
|
|
|
proxy_pass http://socketio_upstream;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $forwarded_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 $forwarded_proto;
|
|
|
|
|
proxy_read_timeout 86400s;
|
|
|
|
|
proxy_send_timeout 86400s;
|
2026-11-19 20:22:01 +06:00
|
|
|
proxy_buffering off;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Streaming CSV/JSON export endpoint on port 3000 (disable response buffering)
|
|
|
|
|
location = /api/export {
|
|
|
|
|
proxy_pass http://nextjs_upstream;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Forwarded-Host $forwarded_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 $forwarded_proto;
|
|
|
|
|
proxy_buffering off;
|
|
|
|
|
proxy_read_timeout 300s;
|
2026-10-23 11:43:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Next.js web application and admin panel to port 3000
|
|
|
|
|
location / {
|
|
|
|
|
proxy_pass http://nextjs_upstream;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $host;
|
2026-11-18 05:18:55 +06:00
|
|
|
proxy_set_header X-Forwarded-Host $forwarded_host;
|
2026-10-23 11:43:49 -05:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2026-11-18 05:18:55 +06:00
|
|
|
proxy_set_header X-Forwarded-Proto $forwarded_proto;
|
2026-10-23 11:43:49 -05:00
|
|
|
}
|
|
|
|
|
}
|