infra/roles/unifi/templates/02-unifi.conf.j2

67 lines
2.3 KiB
Django/Jinja

# ansible
{% set unifi_domain = inventory_hostname.split(".")[1:] | join(".") %}
{% set unifi_url_main = unifi_url3.split(".")[0] ~ "." ~ unifi_domain %}
server {
listen 443 ssl http2;
server_name {{ unifi_url }} {{ unifi_url2 }} {{ unifi_url3 }};
ssl_session_timeout 5m;
ssl_certificate /usr/local/etc/certs/{{ unifi_domain }}/fullchain.pem;
ssl_certificate_key /usr/local/etc/certs/{{ unifi_domain }}/privkey.pem;
include /etc/nginx/authelia_internal.conf;
#include /etc/nginx/require_auth.conf;
location /wss/ {
#include /etc/nginx/require_auth.conf;
proxy_pass https://{{ bridgewithdns.unifi }}:443;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
#proxy_set_header Host $host;
proxy_set_header Host "{{ unifi_url }}";
}
location /inform {
proxy_pass http://localhost:8080;
#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-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
#proxy_set_header Host $host;
proxy_set_header Host "{{ unifi_url }}";
}
location / {
#include /etc/nginx/require_auth.conf;
proxy_pass https://{{ bridgewithdns.unifi }}:443;
proxy_redirect off;
#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-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host "{{ unifi_url }}";
}
access_log /var/log/nginx/access_{{ unifi_url }}.log main;
error_log /var/log/nginx/error_{{ unifi_url }}.log warn;
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
fastcgi_hide_header X-Powered-By;
}