2024-11-11 10:48:06 +00:00
|
|
|
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;
|
|
|
|
}
|
2024-11-11 20:16:26 +00:00
|
|
|
}
|