Files
piik/deploy/nginx/share.bonfire.icu.conf.example
T

97 lines
3.1 KiB
Plaintext

map $http_upgrade $screener_connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name share.bonfire.icu;
location ^~ /.well-known/acme-challenge/ {
root /var/www/letsencrypt;
default_type text/plain;
}
location / {
return 301 https://share.bonfire.icu$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name share.bonfire.icu;
ssl_certificate /etc/letsencrypt/live/share.bonfire.icu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/share.bonfire.icu/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
access_log /var/log/nginx/screener.access.log;
error_log /var/log/nginx/screener.error.log warn;
add_header Strict-Transport-Security "max-age=31536000" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer" always;
add_header X-Frame-Options "DENY" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
# Reject the retired unversioned LiveKit endpoint. Keep this exact location
# out of logs because old URLs may still contain a short-lived join token.
location = /rtc {
access_log off;
error_log /dev/null crit;
return 404;
}
# LiveKit client v0 validates this retired path before joining. Reject it
# explicitly so the broader current-v1 proxy cannot accept an old SDK.
location = /rtc/validate {
access_log off;
error_log /dev/null crit;
return 404;
}
# Current LiveKit clients use v1 paths only. Set
# LIVEKIT_URL to wss://share.bonfire.icu.
location ^~ /rtc/v1 {
# The WebSocket query contains a short-lived LiveKit join token. Do not
# persist the request target in either access or error logs.
access_log off;
error_log /dev/null crit;
proxy_pass http://127.0.0.1:7880;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $screener_connection_upgrade;
proxy_read_timeout 5h;
proxy_send_timeout 5h;
proxy_buffering off;
}
# Reject any other retired or unknown LiveKit path without logging tokens.
location ^~ /rtc/ {
access_log off;
error_log /dev/null crit;
return 404;
}
location / {
proxy_pass http://127.0.0.1:8787;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $screener_connection_upgrade;
proxy_read_timeout 5h;
proxy_send_timeout 5h;
proxy_buffering off;
}
}