coursework/ansible/roles/site_setup/templates/proxy.conf.j2
2024-11-11 23:16:26 +03:00

26 lines
683 B
Django/Jinja

upstream backend_servers {
server {{ backend_ip_1 }}:80;
server {{ backend_ip_2 }}:80;
}
server {
listen 80;
server_name {{ proxy_name }};
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name {{ proxy_name }};
ssl_certificate /etc/nginx/ssl/{{ proxy_name }}.crt;
ssl_certificate_key /etc/nginx/ssl/{{ proxy_name }}.key;
location / {
proxy_pass http://backend_servers;
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;
}
}