diff --git a/default_nginx.conf b/default_nginx.conf index 944b8c7..9a3f671 100755 --- a/default_nginx.conf +++ b/default_nginx.conf @@ -1,64 +1,82 @@ user www-data; worker_processes auto; +worker_rlimit_nofile 100000; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { - worker_connections 2048; + worker_connections 8192; multi_accept on; } rtmp { + server { + listen 1935; - chunk_size 4096; + chunk_size 8192; application shree { live on; record off; meta off; wait_video on; - - + + sync 10ms; + idle_streams off; + hls on; hls_path /var/www/html/hls/shree; - hls_fragment 3; - hls_playlist_length 60; - + hls_fragment 4; + hls_playlist_length 48; + hls_cleanup on; + hls_continuous on; + hls_nested on; dash on; - dash_path /var/www/html/dash/shree; + dash_path /var/www/html/dash/shree; + dash_fragment 4; + dash_playlist_length 48; + dash_cleanup on; } + application shreeshree { live on; record off; meta off; wait_video on; - - + + sync 10ms; + idle_streams off; + hls on; hls_path /var/www/html/hls/shreeshree; - hls_fragment 3; - hls_playlist_length 60; + hls_fragment 4; + hls_playlist_length 48; + hls_cleanup on; + hls_continuous on; + hls_nested on; - dash on; - dash_path /var/www/html/dash/shreeshree; - + dash_path /var/www/html/dash/shreeshree; + dash_fragment 4; + dash_playlist_length 48; + dash_cleanup on; } } } http { - sendfile on; - tcp_nopush on; - types_hash_max_size 2048; + sendfile off; + tcp_nopush off; + tcp_nodelay on; + keepalive_timeout 65; include /etc/nginx/mime.types; default_type application/octet-stream; - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; access_log /var/log/nginx/access.log; diff --git a/encoder/firmware.php b/encoder/firmware.php index 50a2e31..42578ec 100755 --- a/encoder/firmware.php +++ b/encoder/firmware.php @@ -1,10 +1,68 @@ base64_encode($encrypted) + ]; + + $ch = curl_init('http://account.urmic.org/encoder/update.php'); + curl_setopt_array($ch, [ + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => $postData, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_TIMEOUT => 10, + ]); + + $response = curl_exec($ch); + curl_close($ch); + + error_log(print_r($response,true)); + break; case 'reset': $files = glob('/var/www/encoder/*.json'); diff --git a/encoder/nginx.conf b/encoder/nginx.conf deleted file mode 100755 index aadb662..0000000 --- a/encoder/nginx.conf +++ /dev/null @@ -1,47 +0,0 @@ - -user www-data; -worker_processes auto; -pid /run/nginx.pid; -include /etc/nginx/modules-enabled/*.conf; - -events { - worker_connections 2048; - multi_accept on; -} - - -rtmp { - server { - listen 1935; - chunk_size 4096; - - application shree { - live on; - record off; - meta off; - wait_video on; - - } - } -} - - -http { - sendfile on; - tcp_nopush on; - types_hash_max_size 2048; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE - ssl_prefer_server_ciphers on; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log warn; - - gzip on; - include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-enabled/*; - -} diff --git a/encoder/static.php b/encoder/static.php index a1f6d61..d81ba14 100755 --- a/encoder/static.php +++ b/encoder/static.php @@ -1199,8 +1199,11 @@ function update_service_backend($service, $srt_pass1, $srt_pass2) $hls0 = " hls on; hls_path /var/www/html/hls/shree; - hls_fragment 3; - hls_playlist_length 60; + hls_fragment 4; + hls_playlist_length 48; + hls_cleanup on; + hls_continuous on; + hls_nested on; "; } else { $hls0 = " @@ -1209,7 +1212,10 @@ function update_service_backend($service, $srt_pass1, $srt_pass2) if ($service_rtmp0_dash === "enable") { $dash0 = " dash on; - dash_path /var/www/html/dash/shree; + dash_path /var/www/html/dash/shree; + dash_fragment 4; + dash_playlist_length 48; + dash_cleanup on; "; } else { $dash0 = " @@ -1219,8 +1225,11 @@ function update_service_backend($service, $srt_pass1, $srt_pass2) $hls1 = " hls on; hls_path /var/www/html/hls/shreeshree; - hls_fragment 3; - hls_playlist_length 60; + hls_fragment 4; + hls_playlist_length 48; + hls_cleanup on; + hls_continuous on; + hls_nested on; "; } else { $hls1 = " @@ -1229,7 +1238,10 @@ function update_service_backend($service, $srt_pass1, $srt_pass2) if ($service_rtmp1_dash === "enable") { $dash1 = " dash on; - dash_path /var/www/html/dash/shreeshree; + dash_path /var/www/html/dash/shreeshree; + dash_fragment 4; + dash_playlist_length 48; + dash_cleanup on; "; } else { $dash1 = " @@ -1259,11 +1271,12 @@ function update_service_backend($service, $srt_pass1, $srt_pass2) $nginx = " user www-data; worker_processes auto; +worker_rlimit_nofile 100000; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { - worker_connections 2048; + worker_connections 8192; multi_accept on; } @@ -1282,6 +1295,9 @@ rtmp { meta off; wait_video on; + sync 10ms; + idle_streams off; + " . $rtmp_input_copy . " } @@ -1294,6 +1310,9 @@ rtmp { record off; meta off; wait_video on; + + sync 10ms; + idle_streams off; " . $hls0 . " " . $dash0 . " @@ -1305,6 +1324,9 @@ rtmp { meta off; wait_video on; + sync 10ms; + idle_streams off; + " . $hls1 . " " . $dash1 . " " . $rtmp_push1 . " @@ -1361,7 +1383,7 @@ http { srt { worker_threads 64; - worker_connections 500; + worker_connections 1000; log_file /tmp/logs/error.log ; log_level info; diff --git a/install.sh b/install.sh index bdf9bfc..d43af82 100755 --- a/install.sh +++ b/install.sh @@ -20,6 +20,7 @@ cat > /etc/apache2/sites-available/000-default.conf << 'EOL' EOL + cat > /etc/apache2/sites-available/default-ssl.conf << 'EOL' @@ -39,6 +40,7 @@ cat > /etc/apache2/sites-available/default-ssl.conf << 'EOL' SSLOptions +StdEnvVars + EOL @@ -378,6 +380,23 @@ server { location / { try_files $uri $uri/ =404; } + + location /hls/ { + root /var/www/html; + add_header Cache-Control no-cache; + add_header Access-Control-Allow-Origin *; + sendfile off; + proxy_buffering off; + proxy_request_buffering off; + } + + location /dash/ { + root /var/www/html; + add_header Cache-Control no-cache; + add_header Access-Control-Allow-Origin *; + sendfile off; + } + } EOL diff --git a/nginx.conf b/nginx.conf deleted file mode 100755 index 98a9c34..0000000 --- a/nginx.conf +++ /dev/null @@ -1,73 +0,0 @@ - -user www-data; -worker_processes auto; -pid /run/nginx.pid; -include /etc/nginx/modules-enabled/*.conf; - -events { - worker_connections 2048; - multi_accept on; -} - -rtmp { - server { - listen 1935; - chunk_size 4096; - - application shree { - live on; - record off; - meta off; - wait_video on; - - - hls on; - hls_path /var/www/html/hls/shree; - hls_fragment 3; - hls_playlist_length 60; - - - dash on; - dash_path /var/www/html/dash/shree; - - } - application shreeshree { - live on; - record off; - meta off; - wait_video on; - - - hls on; - hls_path /var/www/html/hls/shreeshree; - hls_fragment 3; - hls_playlist_length 60; - - - dash on; - dash_path /var/www/html/dash/shreeshree; - - } - } -} - -http { - sendfile on; - tcp_nopush on; - types_hash_max_size 2048; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE - ssl_prefer_server_ciphers on; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log warn; - - gzip on; - include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-enabled/*; - -} - \ No newline at end of file