mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
- Add stream profile selection to user settings, allowing per-user default streaming profiles - Add configurable environment variables for UWSGI_PORT, REDIS_PORT, and DAPHNE_PORT - Add PostgreSQL database existence check in initialization scripts - Update nginx, uwsgi configs, and entrypoint to use configurable ports
102 lines
2.9 KiB
Nginx Configuration File
102 lines
2.9 KiB
Nginx Configuration File
proxy_cache_path /app/logo_cache levels=1:2 keys_zone=logo_cache:10m
|
|
inactive=24h use_temp_path=off;
|
|
|
|
server {
|
|
listen NGINX_PORT;
|
|
listen [::]:NGINX_PORT;
|
|
|
|
proxy_connect_timeout 75;
|
|
proxy_send_timeout 300;
|
|
proxy_read_timeout 300;
|
|
client_max_body_size 0;
|
|
|
|
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 $host:$server_port;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
# Serve Django via uWSGI
|
|
location / {
|
|
include uwsgi_params;
|
|
uwsgi_pass unix:/app/uwsgi.sock;
|
|
}
|
|
|
|
location /assets/ {
|
|
root /app/static;
|
|
}
|
|
|
|
location /static/ {
|
|
root /app;
|
|
}
|
|
|
|
location /logos/ {
|
|
root /data;
|
|
}
|
|
|
|
# Internal location for X-Accel-Redirect backup downloads
|
|
# Django handles auth, nginx serves the file directly
|
|
location /protected-backups/ {
|
|
internal;
|
|
alias /data/backups/;
|
|
}
|
|
|
|
location /api/logos/(?<logo_id>\d+)/cache/ {
|
|
proxy_pass http://127.0.0.1:UWSGI_PORT;
|
|
proxy_cache logo_cache;
|
|
proxy_cache_key "$scheme$request_uri"; # Cache per logo URL
|
|
proxy_cache_valid 200 24h; # Cache for 24 hours
|
|
proxy_cache_use_stale error timeout updating; # Serve stale if Django is slow
|
|
}
|
|
|
|
location ~ ^/api/channels/logos/(?<logo_id>\d+)/cache/ {
|
|
proxy_pass http://127.0.0.1:UWSGI_PORT;
|
|
proxy_cache logo_cache;
|
|
proxy_cache_key "$scheme$request_uri"; # Cache per logo URL
|
|
proxy_cache_valid 200 24h; # Cache for 24 hours
|
|
proxy_cache_use_stale error timeout updating; # Serve stale if Django is slow
|
|
}
|
|
|
|
# admin disabled when not in dev mode
|
|
location /admin {
|
|
return 301 /login;
|
|
}
|
|
|
|
# Route HDHR request to Django
|
|
location /hdhr {
|
|
include uwsgi_params;
|
|
uwsgi_pass unix:/app/uwsgi.sock;
|
|
}
|
|
|
|
# Serve FFmpeg streams efficiently
|
|
location /output/stream/ {
|
|
proxy_pass http://127.0.0.1:UWSGI_PORT;
|
|
proxy_buffering off;
|
|
proxy_set_header Connection keep-alive;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header Host $host;
|
|
}
|
|
|
|
# WebSockets for real-time communication
|
|
location /ws/ {
|
|
proxy_pass http://127.0.0.1:DAPHNE_PORT;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "Upgrade";
|
|
}
|
|
|
|
# Route TS proxy requests to the dedicated instance
|
|
location /proxy/ {
|
|
include uwsgi_params;
|
|
uwsgi_pass unix:/app/uwsgi.sock;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Connection "";
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
proxy_read_timeout 300s;
|
|
proxy_send_timeout 300s;
|
|
client_max_body_size 0;
|
|
}
|
|
}
|