2024-11-12 20:14:17 +00:00
|
|
|
upstream backend {
|
2024-11-17 16:10:08 +00:00
|
|
|
{% if siteA.site_ip %}
|
|
|
|
server {{ siteA.site_ip }} max_fails=1 fail_timeout=10s;
|
|
|
|
{% endif %}
|
|
|
|
{% if siteB.site_ip %}
|
|
|
|
server {{ siteB.site_ip }} max_fails=1 fail_timeout=10s;
|
|
|
|
{% endif %}
|
2024-11-12 20:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
listen 443 ssl;
|
|
|
|
server_name {{ proxy.proxy_domain }};
|
|
|
|
|
|
|
|
ssl_certificate /etc/nginx/ssl/{{ ssl_cert_file }};
|
|
|
|
ssl_certificate_key /etc/nginx/ssl/{{ ssl_key_file }};
|
|
|
|
|
2024-11-17 15:51:39 +00:00
|
|
|
error_page 502 503 504 /site_down.html;
|
2024-11-17 15:46:24 +00:00
|
|
|
|
2024-11-17 15:51:39 +00:00
|
|
|
location = /site_down.html {
|
2024-11-17 15:46:24 +00:00
|
|
|
root /var/www/errors;
|
|
|
|
internal;
|
|
|
|
}
|
|
|
|
|
2024-11-12 20:14:17 +00:00
|
|
|
location / {
|
|
|
|
proxy_pass http://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;
|
2024-11-12 20:43:48 +00:00
|
|
|
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
|
2024-11-17 15:46:24 +00:00
|
|
|
proxy_intercept_errors on;
|
2024-11-12 20:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
location /health {
|
2024-11-12 20:43:48 +00:00
|
|
|
proxy_pass http://backend/health;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2024-11-12 20:14:17 +00:00
|
|
|
}
|
2024-11-17 16:10:08 +00:00
|
|
|
}
|