Files
mtusi2026lab3/infra/nginx.conf
T

33 lines
1.1 KiB
Nginx Configuration File

# vhost для nginx: монтируется в /etc/nginx/conf.d/default.conf.
upstream api_backend {
# max_fails=1 fail_timeout=5s: после первой ошибки реплика сразу
# исключается из ротации на 5 секунд. Иначе resilience-тест
# «too few successful writes after stop» будет падать.
server api:8080 max_fails=1 fail_timeout=5s;
}
server {
listen 80 default_server;
server_name _;
proxy_connect_timeout 1s;
proxy_send_timeout 10s;
proxy_read_timeout 10s;
location / {
proxy_pass http://api_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
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_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
}
location = /lb/health {
return 200 "ok\n";
add_header Content-Type text/plain;
}
}