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 _;
|
|
|
|
|
|
|
|
|
|
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-10-23 11:43:49 -05:00
|
|
|
proxy_read_timeout 86400;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
}
|
|
|
|
|
}
|