2018-12-13 22:09:22 +00:00
|
|
|
#jinja2: lstrip_blocks: True
|
|
|
|
# {{ ansible_managed }}
|
2018-12-13 23:55:36 +00:00
|
|
|
upstream backend_drone {
|
2018-12-13 22:09:22 +00:00
|
|
|
server {{ droneci_server_ip }}:{{ droneci_server_proxy_port }};
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
2018-12-14 00:02:10 +00:00
|
|
|
server_name {{ droneci_server_name | urlsplit('hostname') }};
|
2018-12-13 22:09:22 +00:00
|
|
|
|
|
|
|
{% if droneci_nginx_tls_enabled %}
|
|
|
|
return 301 https://$server_name$request_uri;
|
|
|
|
{% else %}
|
|
|
|
location / {
|
2018-12-13 23:55:36 +00:00
|
|
|
proxy_pass {{ droneci_server_proxy_protocol }}://backend_drone;
|
2018-12-13 22:09:22 +00:00
|
|
|
|
|
|
|
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;
|
2018-12-14 00:02:10 +00:00
|
|
|
server_name {{ droneci_server_name | urlsplit('hostname') }};
|
2018-12-13 22:09:22 +00:00
|
|
|
|
|
|
|
location / {
|
2018-12-13 23:55:36 +00:00
|
|
|
proxy_pass {{ droneci_server_proxy_protocol }}://backend_drone;
|
2018-12-13 22:09:22 +00:00
|
|
|
|
|
|
|
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 %}
|