xoxys.droneci/templates/nginx/vhost.j2

43 lines
1.2 KiB
Plaintext
Raw Normal View History

2018-12-13 22:09:22 +00:00
#jinja2: lstrip_blocks: True
# {{ ansible_managed }}
upstream backend {
server {{ droneci_server_ip }}:{{ droneci_server_proxy_port }};
}
server {
listen 80;
server_name {{ droneci_server_name }};
{% if droneci_nginx_tls_enabled %}
return 301 https://$server_name$request_uri;
{% else %}
location / {
proxy_pass {{ droneci_server_proxy_protocol }}://backend;
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 }};
location / {
proxy_pass {{ droneci_server_proxy_protocol }}://backend;
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 %}