forked from mtusi2026/mtusi2026lab3
28 lines
713 B
Nginx Configuration File
28 lines
713 B
Nginx Configuration File
worker_processes auto;
|
|
events { worker_connections 1024; }
|
|
|
|
http {
|
|
upstream api_backend {
|
|
server api1:8080 max_fails=2 fail_timeout=5s;
|
|
server api2:8080 max_fails=2 fail_timeout=5s;
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 8080;
|
|
|
|
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_connect_timeout 2s;
|
|
proxy_send_timeout 15s;
|
|
proxy_read_timeout 15s;
|
|
|
|
proxy_next_upstream error timeout http_502 http_503 http_504;
|
|
}
|
|
}
|
|
} |