
All checks were successful
Test and Publish Templates / test-and-publish (push) Successful in 59s
102 lines
2.7 KiB
Nginx Configuration File
102 lines
2.7 KiB
Nginx Configuration File
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
gzip on;
|
|
|
|
# Cache settings for HLS
|
|
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=hls_cache:10m max_size=1g inactive=60m use_temp_path=off;
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Health check
|
|
location /health {
|
|
access_log off;
|
|
return 200 "OK\n";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
|
|
# Main web interface
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
}
|
|
|
|
# HLS streams proxy
|
|
location /hls/ {
|
|
proxy_pass http://localhost:8888/;
|
|
proxy_http_version 1.1;
|
|
|
|
# CORS headers
|
|
add_header Access-Control-Allow-Origin *;
|
|
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
|
add_header Access-Control-Allow-Headers "Range";
|
|
|
|
# Cache HLS segments
|
|
proxy_cache hls_cache;
|
|
proxy_cache_valid 200 1m;
|
|
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
}
|
|
|
|
# WebRTC signaling
|
|
location /webrtc/ {
|
|
proxy_pass http://localhost:8889/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_read_timeout 86400;
|
|
proxy_send_timeout 86400;
|
|
}
|
|
|
|
# MediaMTX API
|
|
location /api/mediamtx/ {
|
|
proxy_pass http://localhost:9997/;
|
|
allow 127.0.0.1;
|
|
allow 172.16.0.0/12;
|
|
deny all;
|
|
}
|
|
|
|
# Recordings
|
|
location /recordings/ {
|
|
alias /recordings/;
|
|
autoindex on;
|
|
autoindex_exact_size off;
|
|
autoindex_localtime on;
|
|
add_header Accept-Ranges bytes;
|
|
add_header Content-Disposition "inline";
|
|
}
|
|
|
|
# API endpoint for recordings list
|
|
location /api/recordings {
|
|
default_type application/json;
|
|
return 200 '{"recordings": []}';
|
|
}
|
|
|
|
# Metrics
|
|
location /metrics {
|
|
proxy_pass http://localhost:9998/metrics;
|
|
allow 127.0.0.1;
|
|
allow 172.16.0.0/12;
|
|
deny all;
|
|
}
|
|
}
|
|
} |