Files
mtusi2026lab3/nginx/nginx.conf
T

30 lines
938 B
Nginx Configuration File

events {
worker_connections 1024;
}
http {
upstream api_cluster {
# Балансировка Round-Robin между репликами Compose
server api:8000 max_fails=2 fail_timeout=5s;
}
server {
listen 8080;
location / {
proxy_pass http://api_cluster;
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-Request-Id $http_x_request_id;
# Мгновенное переключение при падении одной из реплик (Failover)
proxy_next_upstream error timeout http_502 http_503 http_504 non_idempotent;
proxy_next_upstream_timeout 10s;
proxy_next_upstream_tries 3;
proxy_connect_timeout 2s;
proxy_read_timeout 10s;
}
}
}