working ha

This commit is contained in:
2026-02-23 13:00:16 -07:00
parent 3de4cdac62
commit ffb0d9075b
11 changed files with 685 additions and 38 deletions

48
nginx.conf Normal file
View File

@@ -0,0 +1,48 @@
events {
worker_connections 1024;
}
http {
upstream phoenix_backend {
least_conn;
server phoenix1:4000 max_fails=3 fail_timeout=30s;
server phoenix2:4000 max_fails=3 fail_timeout=30s;
server phoenix3:4000 max_fails=3 fail_timeout=30s;
}
# Map to track which backend server a WebSocket connection should use
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 4000;
server_name localhost;
# WebSocket configuration
location /socket {
proxy_pass http://phoenix_backend;
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-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket timeout settings
proxy_read_timeout 86400;
proxy_send_timeout 86400;
}
# HTTP fallback for health checks
location / {
proxy_pass http://phoenix_backend;
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;
}
}
}