Files
mtusi2026lab7/nginx/nginx.conf
T
2026-12-04 19:26:02 +03:00

38 lines
1.1 KiB
Nginx Configuration File

worker_processes auto;
events { worker_connections 1024; }
http {
upstream api_backend {
least_conn;
server api1:8080 max_fails=1 fail_timeout=2s;
server api2:8080 max_fails=1 fail_timeout=2s;
}
server {
listen 8443 ssl;
# Пути к сертификатам (мы сгенерируем их в шаге 2)
ssl_certificate /etc/nginx/certs/nginx.crt;
ssl_certificate_key /etc/nginx/certs/nginx.key;
location = /lb-health {
access_log off;
return 200 'ok';
add_header Content-Type text/plain;
}
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_next_upstream error timeout http_502 http_503 http_504;
proxy_connect_timeout 2s;
proxy_read_timeout 10s;
}
}
}