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

69 lines
1.9 KiB
Django/Jinja

map $http_upgrade $connection_upgrade {
default upgrade;
#default $http_connection;
'' close;
}
server {
{% set domain = inventory_hostname.split('.')[1:] | join('.') %}
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;
include /etc/nginx/authelia_internal.conf;
include /etc/nginx/sudo-known.conf;
server_name printer.{{ domain }};
location = /server_status {
stub_status;
access_log off;
allow 127.0.0.1;
allow 144.76.59.83;
allow 2a01:4f8:191:6352::2;
allow 172.18.0.0/16;
deny all;
}
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host "127.0.0.1";
proxy_ssl_verify off;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
proxy_pass https://127.0.0.1:631;
}
location /admin {
include /etc/nginx/require_auth.conf;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host "127.0.0.1";
proxy_ssl_verify off;
proxy_pass_request_headers on;
proxy_pass https://127.0.0.1:631;
}
access_log /var/log/nginx/access_printer.{{ domain }}.log main;
error_log /var/log/nginx/error_printer.{{ domain }}.log warn;
ssl_session_timeout 5m;
ssl_certificate /usr/local/etc/certs/{{ domain }}/fullchain.pem;
ssl_certificate_key /usr/local/etc/certs/{{ domain }}/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
fastcgi_hide_header X-Powered-By;
}