infra/roles/invidious/templates/01-invidious.conf.j2

38 lines
1.2 KiB
Django/Jinja

server {
listen 443 ssl http2;
{% if inventory_hostname in wg_clients -%}
listen {{ wg_clients[inventory_hostname].ip }}:443 ssl http2;
{% endif -%}
include listen-proxy-protocol.conf;
server_name {{ invidious_url }};
# access_log off;
access_log /var/log/nginx/access_{{ invidious_url }}.log main;
error_log /var/log/nginx/error_{{ invidious_url }}.log warn;
ssl_certificate /usr/local/etc/certs/{{ invidious_url }}/fullchain.pem;
ssl_certificate_key /usr/local/etc/certs/{{ invidious_url }}/privkey.pem;
location ~ ^/api/health {
allow 127.0.0.1;
allow {{ my_public_ips[inventory_hostname] }}/32;
allow {{ my_public_ips[ansible_control_host] }}/32;
deny all;
proxy_pass http://{{ bridgewithdns.invidious }}:3000;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
location / {
proxy_pass http://{{ bridgewithdns.invidious }}:3000/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host; # so Invidious knows domain
proxy_http_version 1.1; # to keep alive
proxy_set_header Connection ""; # to keep alive
}
}