forked from mtusi2026/mtusi2026lab7
3_grade_report
This commit is contained in:
+15
-15
@@ -5,34 +5,34 @@ 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;
|
||||
# Теперь API слушает HTTPS на 8443
|
||||
server api1:8443 max_fails=1 fail_timeout=2s;
|
||||
server api2:8443 max_fails=1 fail_timeout=2s;
|
||||
}
|
||||
|
||||
server {
|
||||
# Внешний HTTPS для клиентов
|
||||
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;
|
||||
}
|
||||
ssl_certificate /etc/nginx/certs/server.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/server.key;
|
||||
|
||||
location / {
|
||||
proxy_pass http://api_backend;
|
||||
proxy_pass https://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;
|
||||
# mTLS: Nginx предъявляет клиентский сертификат API
|
||||
proxy_ssl_certificate /etc/nginx/certs/client.crt;
|
||||
proxy_ssl_certificate_key /etc/nginx/certs/client.key;
|
||||
|
||||
# mTLS: Nginx проверяет сертификат API
|
||||
proxy_ssl_verify on;
|
||||
proxy_ssl_trusted_certificate /etc/nginx/certs/ca.crt;
|
||||
proxy_ssl_verify_depth 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user