forked from mtusi2026/mtusi2026lab5
28 lines
706 B
Nginx Configuration File
28 lines
706 B
Nginx Configuration File
events { worker_connections 1024; }
|
|
|
|
http {
|
|
upstream api_backend {
|
|
least_conn;
|
|
server app1:8080 max_fails=2 fail_timeout=5s;
|
|
server app2:8080 max_fails=2 fail_timeout=5s;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
|
|
client_max_body_size 10M;
|
|
|
|
location / {
|
|
proxy_pass http://api_backend;
|
|
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_connect_timeout 2s;
|
|
proxy_send_timeout 5s;
|
|
proxy_read_timeout 5s;
|
|
}
|
|
}
|
|
}
|