2025-12-15 11:34:49 +08:00
|
|
|
# SRS 配置文件 - 直播系统
|
|
|
|
|
listen 1935;
|
|
|
|
|
max_connections 1000;
|
|
|
|
|
daemon off;
|
|
|
|
|
srs_log_tank console;
|
|
|
|
|
|
|
|
|
|
http_server {
|
|
|
|
|
enabled on;
|
|
|
|
|
listen 8080;
|
|
|
|
|
dir ./objs/nginx/html;
|
|
|
|
|
crossdomain on;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
http_api {
|
|
|
|
|
enabled on;
|
|
|
|
|
listen 1985;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vhost __defaultVhost__ {
|
|
|
|
|
# HLS 配置
|
|
|
|
|
hls {
|
|
|
|
|
enabled on;
|
|
|
|
|
hls_fragment 2;
|
|
|
|
|
hls_window 10;
|
|
|
|
|
hls_path ./objs/nginx/html;
|
|
|
|
|
hls_m3u8_file [app]/[stream].m3u8;
|
|
|
|
|
hls_ts_file [app]/[stream]-[seq].ts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# HTTP-FLV 配置 (低延迟)
|
|
|
|
|
http_remux {
|
|
|
|
|
enabled on;
|
2025-12-15 16:39:46 +08:00
|
|
|
mount [app]/[stream].flv;
|
2025-12-15 11:34:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# HTTP 回调配置
|
|
|
|
|
http_hooks {
|
|
|
|
|
enabled on;
|
2025-12-15 16:39:46 +08:00
|
|
|
on_publish http://localhost:3001/api/srs/on_publish;
|
|
|
|
|
on_unpublish http://localhost:3001/api/srs/on_unpublish;
|
2025-12-15 11:34:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# GOP 缓存,提高首屏速度
|
|
|
|
|
play {
|
|
|
|
|
gop_cache on;
|
|
|
|
|
queue_length 10;
|
|
|
|
|
}
|
|
|
|
|
}
|