mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 14:54:55 +00:00
92 lines
2.4 KiB
Plaintext
92 lines
2.4 KiB
Plaintext
# Nginx configuration for HLS streaming
|
|
# Optimized for low-latency video delivery
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# Enable CORS
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Range' always;
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length, Content-Range' always;
|
|
|
|
# Cache settings
|
|
add_header Cache-Control 'no-cache';
|
|
|
|
# HLS/DASH content
|
|
location /hls {
|
|
alias /data/hls;
|
|
|
|
# MIME types for HLS
|
|
types {
|
|
application/vnd.apple.mpegurl m3u8;
|
|
video/mp2t ts;
|
|
application/dash+xml mpd;
|
|
video/mp4 mp4 m4s;
|
|
}
|
|
|
|
# Caching for segments
|
|
location ~ \.ts$ {
|
|
add_header Cache-Control 'public, max-age=31536000';
|
|
}
|
|
|
|
location ~ \.m4s$ {
|
|
add_header Cache-Control 'public, max-age=31536000';
|
|
}
|
|
|
|
# No caching for playlists
|
|
location ~ \.m3u8$ {
|
|
add_header Cache-Control 'no-cache, no-store, must-revalidate';
|
|
add_header Pragma 'no-cache';
|
|
add_header Expires '0';
|
|
}
|
|
|
|
location ~ \.mpd$ {
|
|
add_header Cache-Control 'no-cache, no-store, must-revalidate';
|
|
add_header Pragma 'no-cache';
|
|
add_header Expires '0';
|
|
}
|
|
}
|
|
|
|
# Radio streams (HLS)
|
|
location /radio {
|
|
alias /data/hls/radio;
|
|
|
|
types {
|
|
application/vnd.apple.mpegurl m3u8;
|
|
video/mp2t ts;
|
|
audio/aac aac;
|
|
}
|
|
|
|
location ~ \.m3u8$ {
|
|
add_header Cache-Control 'no-cache';
|
|
}
|
|
}
|
|
|
|
# TV streams (HLS)
|
|
location /tv {
|
|
alias /data/hls/tv;
|
|
|
|
types {
|
|
application/vnd.apple.mpegurl m3u8;
|
|
video/mp2t ts;
|
|
video/mp4 mp4 m4s;
|
|
}
|
|
|
|
location ~ \.m3u8$ {
|
|
add_header Cache-Control 'no-cache';
|
|
}
|
|
}
|
|
|
|
# Health check
|
|
location /nginx-health {
|
|
return 200 'OK';
|
|
add_header Content-Type text/plain;
|
|
}
|
|
|
|
# Gzip
|
|
gzip on;
|
|
gzip_types application/vnd.apple.mpegurl application/dash+xml;
|
|
}
|