-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
573 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
user root; | ||
daemon off; | ||
master_process on; | ||
worker_processes 1; | ||
#worker_rlimit 4g; | ||
|
||
#error_log logs/error.log; | ||
#error_log logs/error.log notice; | ||
error_log logs/error.log error; | ||
|
||
worker_rlimit_nofile 102400; | ||
worker_rlimit_core 2G; | ||
working_directory /tmp/; | ||
|
||
pid logs/nginx.pid; | ||
|
||
events { | ||
use epoll; | ||
worker_connections 4096; | ||
multi_listen unix:/tmp/http 80; | ||
multi_listen unix:/tmp/https 443; | ||
multi_listen unix:/tmp/rtmp 1935; | ||
|
||
dynamic_refresh_interval 5s; | ||
dynamic_domain_buckets 1001; | ||
resolver 114.114.114.114 valid=10s; | ||
resolver_timeout 30s; | ||
} | ||
|
||
#stream_zone buckets=1024 streams=4096; | ||
|
||
#dynamic_conf conf/nginx_dynamic.conf 10; | ||
#dynamic_log logs/dynamic.log info; | ||
|
||
rtmp { | ||
# log_format log_bandwidth '{"app":"$app","name":"$name","bitrate":$bitrate,"args":"$args","timestamp":$ntp,"ts":"$time_local","type":"$command","remoteAddr":"$remote_addr","announceIp":"39.101.194.173"}'; | ||
# access_log logs/bandwidth.log log_bandwidth trunc=5s; | ||
|
||
server { | ||
listen 1935 so_keepalive=2s:2s:3; | ||
serverid live; | ||
out_queue 2048; | ||
rtmp_auto_pull on; | ||
rtmp_auto_pull_port unix:/tmp/rtmp; | ||
timeout 5s; | ||
max_message 6291456; | ||
idle_streams off; | ||
|
||
application audio { | ||
on_play http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clietip=$remote_addr&silent=1&$pargs; | ||
on_publish http://127.0.0.1:6080/v1/live/notify stage=start,update,done update=10s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&silent=1&$pargs; | ||
on_pull http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=push&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=record&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=transcode&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=hls&$pargs; | ||
|
||
hls off; | ||
hls_path /tmp/hls; | ||
hls_fragment 4000ms; | ||
hls_max_fragment 10000ms; | ||
hls_playlist_length 12000ms; | ||
hls_type live; | ||
|
||
hls2 off; | ||
mpegts_cache_time 0s; | ||
|
||
hls2_fragment 2000ms; | ||
hls2_max_fragment 3000ms; | ||
hls2_playlist_length 6000ms; | ||
|
||
live on; | ||
# wait_key on; | ||
# wait_video on; | ||
cache_time 1s; | ||
send_all on; | ||
low_latency off; | ||
fix_timestamp 0s; | ||
# h265 codecid, default 12 | ||
hevc_codecid 12; | ||
} | ||
|
||
application * { | ||
on_play http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clietip=$remote_addr&silent=1&$pargs; | ||
on_publish http://127.0.0.1:6080/v1/live/notify stage=start,update,done update=10s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&silent=1&$pargs; | ||
on_pull http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=push&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=record&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=transcode&$pargs; | ||
on_push http://127.0.0.1:6080/v1/live/notify stage=start,done update=30s args=serverid=$serverid&scheme=$scheme&clientip=$remote_addr&invoke=hls&$pargs; | ||
|
||
live_record off; | ||
live_record_path /data/record; | ||
|
||
hls off; | ||
hls_path /tmp/hls; | ||
hls_fragment 4000ms; | ||
hls_max_fragment 10000ms; | ||
hls_playlist_length 12000ms; | ||
hls_type live; | ||
|
||
hls2 off; | ||
mpegts_cache_time 0s; | ||
|
||
hls2_fragment 2000ms; | ||
hls2_max_fragment 3000ms; | ||
hls2_playlist_length 6000ms; | ||
|
||
live on; | ||
wait_key on; | ||
wait_video on; | ||
cache_time 1s; | ||
send_all on; | ||
low_latency off; | ||
fix_timestamp 0s; | ||
# h265 codecid, default 12 | ||
hevc_codecid 12; | ||
} | ||
} | ||
} | ||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_X-Forwarded-For" "$http_X-Real-IP" "$host"'; | ||
|
||
access_log logs/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
#keepalive_timeout 0; | ||
keepalive_timeout 65; | ||
|
||
#reset_server_name www.test1.com www.test2.com; | ||
#gzip on; | ||
|
||
server { | ||
listen 80; | ||
listen 443 ssl; | ||
ssl_certificate /cert/fullchain.pem; | ||
ssl_certificate_key /cert/privkey.pem; | ||
location /rtmp_stat { | ||
rtmp_stat all; | ||
rtmp_stat_stylesheet /stat.xsl; | ||
} | ||
|
||
location /xstat { | ||
rtmp_stat all; | ||
} | ||
|
||
location /sys_stat { | ||
sys_stat; | ||
} | ||
|
||
location /proxy/ { | ||
rewrite ^/proxy/(.*) /sys_stat break; | ||
proxy_pass http://$1:; | ||
} | ||
|
||
location /bs { | ||
broadcast unix:/tmp/http /proxy; | ||
broadcast_rewrite_prefix "," [; | ||
broadcast_suffix ]; | ||
return 200; | ||
} | ||
|
||
location ~ .mp4$ { | ||
root html; | ||
#mp4; | ||
} | ||
|
||
location /control { | ||
rtmp_control all; | ||
} | ||
location /flv { | ||
flv_live 1935; | ||
chunked_transfer_encoding off; | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
add_header "Access-Control-Allow-Credentials" "true"; | ||
add_header "Access-Control-Allow-Methods" "*"; | ||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token"; | ||
add_header "Access-Control-Expose-Headers" "*"; | ||
} | ||
location /ts { | ||
ts_live 1935 app=live; | ||
expires -1; | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
add_header "Access-Control-Allow-Credentials" "true"; | ||
add_header "Access-Control-Allow-Methods" "*"; | ||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token"; | ||
add_header "Access-Control-Expose-Headers" "*"; | ||
} | ||
location /hls { | ||
types { | ||
application/vnd.apple.mpegurl m3u8; | ||
video/mp2t ts; | ||
} | ||
root /tmp; | ||
expires -1; | ||
add_header Cache-Control no-cache; | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
add_header "Access-Control-Allow-Credentials" "true"; | ||
add_header "Access-Control-Allow-Methods" "*"; | ||
add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token"; | ||
add_header "Access-Control-Expose-Headers" "*"; | ||
} | ||
|
||
location / { | ||
if ($request_method = 'OPTIONS') { | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE' always; | ||
add_header 'Access-Control-Allow-Headers' '*' always; | ||
add_header 'Access-Control-Max-Age' 1728000 always; | ||
add_header 'Content-Length' 0; | ||
add_header 'Content-Type' 'text/plain; charset=utf-8'; | ||
return 200; | ||
} | ||
chunked_transfer_encoding on; | ||
root html/; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.