64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
server {
|
|
if ($host = in.vish.gg) {
|
|
return 301 https://$host$request_uri;
|
|
} # managed by Certbot
|
|
|
|
|
|
listen 80;
|
|
server_name in.vish.gg;
|
|
|
|
# Redirect all HTTP traffic to HTTPS
|
|
return 301 https://$host$request_uri;
|
|
|
|
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name in.vish.gg;
|
|
|
|
# SSL Certificates (Certbot paths)
|
|
ssl_certificate /etc/letsencrypt/live/in.vish.gg/fullchain.pem; # managed by Certbot
|
|
ssl_certificate_key /etc/letsencrypt/live/in.vish.gg/privkey.pem; # managed by Certbot
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
# --- Reverse Proxy to Invidious ---
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
proxy_http_version 1.1;
|
|
|
|
# Required headers for reverse proxying
|
|
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-Proto $scheme;
|
|
|
|
# WebSocket and streaming stability
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
# Disable buffering for video streams
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
|
|
# Avoid premature timeouts during long playback
|
|
proxy_read_timeout 600s;
|
|
proxy_send_timeout 600s;
|
|
}
|
|
|
|
# Cache static assets (images, css, js) for better performance
|
|
location ~* \.(?:jpg|jpeg|png|gif|ico|css|js|webp)$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, no-transform";
|
|
proxy_pass http://127.0.0.1:3000;
|
|
}
|
|
|
|
# Security headers (optional but sensible)
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
add_header X-Content-Type-Options nosniff;
|
|
add_header X-Frame-Options SAMEORIGIN;
|
|
add_header Referrer-Policy same-origin;
|
|
|
|
}
|