worker_processes 1;
events {
worker_connections 1024;
}
#这里开始是牛人技术测试直播的配置信息
rtmp {
server {
listen 1935;
chunk_size 4096;
application hls {
live on;
hls on;
hls_path /byDATA/NginxRtmpNRJS/webroot/tt/hls;
hls_fragment 5s;
}
#用来给115频道
application ANuid115 {
live on;
hls on;
hls_path /byDATA/NginxRtmp/webroot/ANuid115;
hls_fragment 5s;
}
#用来测试
application ANuid901 {
live on;
hls on; #实时回访
wait_key on; #保护TS切片
hls_nested on; #每个流都自动创建一个文件夹
hls_fragment 5s; #每个ts文件为5s的样子
hls_fragment_naming system;#使用系统时间戳命名ts文件
hls_playlist_length 10800s; #保存m3u8列表长度时间,默认是30秒,可考虑三小时10800秒
hls_cleanup on; #是否删除列表中已经没有的媒体块TS文件,默认是开启
hls_continuous on; #连续模式
hls_path /byDATA/NginxRtmp/webroot/live/record/ANuid901; #媒体块ts的位置
}
application ANuid902 {
live on;
hls on;
hls_path /byDATA/NginxRtmp/webroot/tt/ANuid902;
hls_fragment 5s;
}
application ANuid903 {
live on;
hls on;
hls_path /byDATA/NginxRtmp/webroot/tt/ANuid903;
hls_fragment 5s;
}
}
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#byAdd
#include /byDATA/NginxRtmp/conf/*.conf; 此处可以添加自定义配置文件目录
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#byAdd
#root /byDATA/NginxRtmp/webroot/tt;
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
#byAdd
server {
listen 80;
server_name flow.320023.com;
location /ANuid901 {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /byDATA/NginxRtmp/webroot/live/record;
add_header Cache-Control no-cache;
}
#推流状态查看 http://flow.320023.com/stat
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root /byDATA/NginxRtmp/Program/nginx-rtmp-module-master/;
}
#rewrite /ANuid901/(.*).m3u8$ /ANuid901/$1/index.m3u8 last; #重写用于兼容阿里云m3u8命名格式
#rewrite /ANuid901/(.*).ts$ /ANuid901/StreamName/$1.ts last; #重写让上面m3u8能找到ts文件
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
http://www.nrjs.cn/maintenance/37.htm
来源:https://www.cnblogs.com/han-guang-xue/p/12367042.html