xoxys.cups/templates/nginx/vhost.j2

43 lines
1.1 KiB
Plaintext
Raw Normal View History

2019-02-10 17:21:25 +00:00
#jinja2: lstrip_blocks: True
# {{ ansible_managed }}
upstream backend_cups {
server {{ cups_nginx_proxy_url }};
}
server {
listen 80;
server_name {{ cups_listen_address }};
{% if cups_nginx_tls_enabled %}
return 301 https://$server_name$request_uri;
{% else %}
location / {
proxy_pass http://backend_cups;
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 cups_nginx_tls_enabled %}
server {
listen 443 ssl;
server_name {{ cups_listen_address }};
location / {
proxy_pass http://backend_cups;
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/{{ cups_nginx_tls_cert_file }};
ssl_certificate_key /etc/pki/tls/private/{{ cups_nginx_tls_key_file }};
}
{% endif %}