From 80202deb89b24ae2cf9e84cc06620e1e867da511 Mon Sep 17 00:00:00 2001 From: BluemediaGER Date: Fri, 30 Jul 2021 22:58:51 +0200 Subject: [PATCH] Move HLS file path to tempfs --- config/nginx-ssl.conf.skel | 16 +++++++++++----- config/nginx.conf.skel | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/config/nginx-ssl.conf.skel b/config/nginx-ssl.conf.skel index 34a1c86..aad2997 100644 --- a/config/nginx-ssl.conf.skel +++ b/config/nginx-ssl.conf.skel @@ -72,7 +72,8 @@ rtmp { # Turn on HLS hls on; - hls_path /var/www/html/hls/; + hls_path /tmp/hls; + hls_fragment_naming system; hls_fragment {HLS_FRAGMENT_LENGTH}; hls_playlist_length {HLS_PLAYLIST_LENGTH}; } @@ -108,12 +109,17 @@ http { return 404; } - # Disable cache - add_header 'Cache-Control' 'no-cache'; + # Serve HLS files from tempfs + location /hls { + root /tmp; + # Don't let browsers cache HLS files + add_header Cache-Control no-cache; + } - root /var/www/html/; - index index.html index.htm; + # Serve frontend location / { + root /var/www/html; + index index.html index.htm; try_files $uri $uri/ =404; } } diff --git a/config/nginx.conf.skel b/config/nginx.conf.skel index 359dcbe..7694a6a 100644 --- a/config/nginx.conf.skel +++ b/config/nginx.conf.skel @@ -59,7 +59,8 @@ rtmp { # Turn on HLS hls on; - hls_path /var/www/html/hls/; + hls_path /tmp/hls; + hls_fragment_naming system; hls_fragment {HLS_FRAGMENT_LENGTH}; hls_playlist_length {HLS_PLAYLIST_LENGTH}; } @@ -95,12 +96,17 @@ http { return 404; } - # Disable cache - add_header 'Cache-Control' 'no-cache'; + # Serve HLS files from tempfs + location /hls { + root /tmp; + # Don't let browsers cache HLS files + add_header Cache-Control no-cache; + } - root /var/www/html/; - index index.html index.htm; + # Serve frontend location / { + root /var/www/html; + index index.html index.htm; try_files $uri $uri/ =404; } }