xoxys.droneci/templates/nginx/vhost.j2
Robert Kaussow 96fb7fb036
All checks were successful
continuous-integration/drone/push Build is passing
fix ansible 2.8 bool vars
2019-06-10 14:09:49 +02:00

43 lines
1.3 KiB
Django/Jinja

#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 %}
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 %}
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 %}