user www www;
worker_processes 1;
error_log logs/error.log debug;
#pid logs/nginx.pid;
events {
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '[$time_local][$remote_addr][$http_x_forwarded_for] $status "$request" "$http_referer" "$http_user_agent"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
server {
set $wwwroot /home/www/node/html;
listen 80;
server_name localhost;
index index.html;
root $wwwroot;
access_log logs/node.access.log main;
location ~ .*\.(js|css)?$ {
expires 2d;
access_log off;
}
#html
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|rar|zip|txt|mid|doc|ppt|pdf|xls)$ {
expires 30d;
access_log off;
}
location /rtmp/stat {
rtmp_stat all;
rtmp_stat_stylesheet rtmpstat.xsl;
}
location /rtmpstat.xsl {
}
location /rtmp/control {
rtmp_control all;
}
location ~* /hls/.*\.m3u8$ {
types {
application/vnd.apple.mpegurl m3u8;
}
root /tmp;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
location ~* /hls/.*\.ts$ {
types {
video/mp2t ts;
}
root /tmp;
expires 1m;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
}
#error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location / {
}
#控制rtmp模塊
location /control {
rtmp_control all;
}
}
}
rtmp {
server {
listen 1935;
ping 5s;
timeout 10s;
notify_method get;
drop_idle_publisher 10s;
application live { ##這個是直播節(jié)點
live on;
#exec /home/www/amaiStream/streamPushToLiveNode.sh;
exec /home/www/bin/rtmpDispatch.sh $name
exec_kill_signal term;
exec_publish_done /home/www/bin/pubDone.sh $name;
#設(shè)置是否保存錄像(手動)
recorder rec {
record all manual; #在活動服務(wù)器進行錄像,手動控制
record_unique on;
record_notify on;
record_max_size 512M;
#record_interval 30s;
record_path /data/recorded_flvs;
record_suffix wsl.flv; #文件的后綴
#錄像停止后,先判斷是否能上傳,允許后則將錄像上傳到OSS/
#exec_record_done /home/www/bin/rtmpRecorded.sh $name $path $filename $basename $dirname;
}
}
application hls {
live on;
hls on;
hls_path /tmp/hls;
#live, event
hls_type live;
#hls_sync 100ms;
#sequential, timestamp, system
hls_fragment_naming system;
hls_fragment_naming_granularity 500;
#plain, aligned
hls_fragment_slicing aligned;
hls_fragment 3s;
#hls_fragment 5s;
hls_playlist_length 15s;
}
}
}