2019-02-01 23:57:15 +00:00
|
|
|
#jinja2: lstrip_blocks: True
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
upstream backend_jellyfin {
|
|
|
|
server {{ jellyfin_nginx_proxy_ip }}:{{ jellyfin_nginx_proxy_port }};
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name {{ jellyfin_base_url | urlsplit('hostname') }};
|
|
|
|
|
|
|
|
client_max_body_size 200M;
|
|
|
|
|
|
|
|
{% if jellyfin_nginx_tls_enabled %}
|
|
|
|
return 301 https://$server_name$request_uri;
|
|
|
|
{% else %}
|
|
|
|
location / {
|
2019-02-02 00:12:15 +00:00
|
|
|
proxy_pass http://backend_jellyfin;
|
2019-02-01 23:57:15 +00:00
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
}
|
|
|
|
|
|
|
|
{% if jellyfin_nginx_tls_enabled %}
|
|
|
|
server {
|
|
|
|
listen 443 ssl;
|
|
|
|
server_name {{ jellyfin_base_url | urlsplit('hostname') }};
|
|
|
|
|
|
|
|
client_max_body_size 200M;
|
|
|
|
|
|
|
|
location / {
|
2019-02-02 00:12:15 +00:00
|
|
|
proxy_pass http://backend_jellyfin;
|
2019-02-02 00:24:11 +00:00
|
|
|
proxy_set_header Range $http_range;
|
|
|
|
proxy_set_header If-Range $http_if_range;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
#Next three lines allow websockets
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
2019-02-01 23:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ssl_certificate /etc/pki/tls/certs/{{ jellyfin_nginx_tls_cert_file }};
|
|
|
|
ssl_certificate_key /etc/pki/tls/private/{{ jellyfin_nginx_tls_key_file }};
|
|
|
|
}
|
|
|
|
{% endif %}
|