Files
mtusi2026lab4/lb/nginx.conf.template
2026-10-30 21:09:56 +03:00

45 lines
1.3 KiB
Plaintext

worker_processes ${NGINX_WORKERS};
error_log /dev/stderr warn;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
access_log off;
resolver 127.0.0.11 valid=2s ipv6=off;
resolver_timeout 2s;
upstream api_upstream {
zone api_upstream 64k;
server api:8080 resolve max_fails=1 fail_timeout=5s;
keepalive 32;
}
server {
listen 8080;
# Lab4 attachments ≤10 MiB; allow a little headroom for multipart/headers.
client_max_body_size 12m;
client_body_timeout 60s;
location / {
proxy_pass http://api_upstream;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
proxy_next_upstream_timeout 10s;
proxy_connect_timeout 2s;
# Uploads/downloads of ≤10 MiB need longer than JSON chat traffic.
proxy_read_timeout 120s;
proxy_send_timeout 120s;
}
}
}