config配置文件:
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 { ##这个是直播节点 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; #设置是否保存录像(手动) recorder rec { record all manual; #在活动服务器进行录像,手动控制 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; } } }
时间: 2024-10-11 17:35:23