Messenger/infra/nginx/nginx.conf
Заид Омар Медхат | Zaid Omar Medhat 62f20f8843 init
2026-07-10 13:31:12 +05:00

45 lines
1.1 KiB
Nginx Configuration File

worker_processes auto;
events {
worker_connections 1024;
}
http {
# Upstreams resolve to compose service names on the private network.
upstream backend {
server backend:4000;
}
upstream centrifugo {
server centrifugo:8000;
}
server {
listen 80;
server_name _;
# REST API — strip the /api prefix before proxying to the backend.
location /api/ {
proxy_pass http://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;
}
# Realtime WebSocket — Centrifugo (receive-only client socket).
location /connection/websocket {
proxy_pass http://centrifugo;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 3600s;
}
location / {
default_type text/plain;
return 200 "Altricade gateway /api/* -> backend, /connection/websocket -> centrifugo\n";
}
}
}