#jinja2: lstrip_blocks: True # {{ ansible_managed }} upstream backend_drone { server {{ droneci_server_ip }}:{{ droneci_server_proxy_port }}; } server { listen 80; server_name {{ droneci_server_name | urlsplit('hostname') }}; {% if droneci_nginx_tls_enabled | bool %} return 301 https://$server_name$request_uri; {% else %} location / { proxy_pass {{ droneci_server_proxy_protocol }}://backend_drone; 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; } {% endif %} } {% if droneci_nginx_tls_enabled | bool %} server { listen 443 ssl; server_name {{ droneci_server_name | urlsplit('hostname') }}; location / { proxy_pass {{ droneci_server_proxy_protocol }}://backend_drone; 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; } ssl_certificate /etc/pki/tls/certs/{{ droneci_tls_key_path | basename }}; ssl_certificate_key /etc/pki/tls/private/{{ droneci_tls_key_path | basename }}; } {% endif %}