coursework/ansible/roles/nginx_proxy/templates/proxy.conf.j2

30 lines
901 B
Plaintext
Raw Normal View History

2024-11-12 20:14:17 +00:00
upstream backend {
{% for server in upstream_servers %}
2024-11-12 21:05:56 +00:00
server {{ server }} max_fails=1 fail_timeout=5s;
2024-11-12 20:14:17 +00:00
{% endfor %}
}
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 }};
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-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-12 20:51:47 +00:00
}