Files
mtusi2026lab7/infra/nginx.conf
T
2026-11-28 12:29:50 +01:00

44 lines
1.4 KiB
Nginx Configuration File

events {
worker_connections 1024;
}
http {
access_log /dev/stdout;
error_log /dev/stderr warn;
upstream api_backend {
server api1:8443 max_fails=1 fail_timeout=5s;
server api2:8443 max_fails=1 fail_timeout=5s;
}
server {
listen 8443 ssl;
ssl_certificate /certs/ingress.crt;
ssl_certificate_key /certs/private/ingress.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache off;
location / {
# Outbound mTLS: the API replicas require and verify the LB identity.
proxy_pass https://api_backend;
proxy_ssl_certificate /certs/lb.crt;
proxy_ssl_certificate_key /certs/private/lb.key;
proxy_ssl_trusted_certificate /certs/ca.crt;
proxy_ssl_verify on;
proxy_ssl_verify_depth 2;
proxy_ssl_name api1; # both leaf certs carry api1/api2/api SANs
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection "";
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_connect_timeout 1s;
proxy_send_timeout 10s;
proxy_read_timeout 10s;
}
}
}