server { listen 80; server_name {{ item.name }}; location / { return 301 https://$host$request_uri; } } server { listen 443 ssl http2; server_name {{ item.name }}; ssl_certificate /etc/letsencrypt/live/{{ item.name }}/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/{{ item.name }}/privkey.pem; location / { proxy_pass http://{{ item.upstream.host }}:{{ item.upstream.port }}; } }