Files
mtusi2026lab3/infrastructure/nginx/nginx.conf
T
2026-10-21 13:51:35 +03:00

42 lines
1.1 KiB
Nginx Configuration File

worker_processes auto;
events {
worker_connections 1024;
}
http {
resolver 127.0.0.11 valid=1s ipv6=off;
upstream api_backend {
zone api_backend 64k;
least_conn;
server api:8080 resolve max_fails=1 fail_timeout=1s;
}
server {
listen 8080;
server_name _;
location / {
proxy_pass http://api_backend;
proxy_http_version 1.1;
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;
proxy_set_header Connection "";
proxy_connect_timeout 1s;
proxy_send_timeout 20s;
proxy_read_timeout 20s;
# Safe methods may transparently move to another healthy peer.
# Nginx deliberately does not retry non-idempotent POST requests:
# the client retries message POSTs with its Idempotency-Key.
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
}
}
}