Files
mtusi2026lab3/infra/nginx/nginx.conf
T

34 lines
1.0 KiB
Nginx Configuration File

worker_processes auto;
events { worker_connections 1024; }
http {
log_format main '$remote_addr "$request" $status $upstream_addr $request_time';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
upstream api_backend {
server api-1:8080 max_fails=2 fail_timeout=5s;
server api-2:8080 max_fails=2 fail_timeout=5s;
keepalive 32;
}
server {
listen 8080;
client_max_body_size 16m;
location / {
proxy_pass http://api_backend;
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_connect_timeout 2s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 2;
}
}
}