user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { proxy_cache_path /var/cache/hls keys_zone=hls:10m max_size=10g inactive=60m use_temp_path=off; proxy_cache_path /var/cache/dash levels=1:2 keys_zone=dash:10m max_size=10g inactive=60m use_temp_path=off; server { listen 8080; listen [::]:8080; # This URL provides RTMP statistics in XML location /stat { proxy_pass http://streaming-server.tld/stat; # Use this stylesheet to view XML as web page # in browser #rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { # XML stylesheet to view RTMP stats. # Copy stat.xsl wherever you want # and put the full directory path here proxy_pass http://streaming-server.tld/stat.xsl; } location ~* \.(m3u8)$ { proxy_cache off; # Do not activate proxy cache (i.e m3u8,f4m,... playlist files) expires -1; # Cache-Control: no-cache proxy_pass http://streaming-server.tld$request_uri; } location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } proxy_cache hls; proxy_ignore_headers Cache-Control; proxy_cache_valid any 30m; proxy_pass http://streaming-server.tld$request_uri; #add_header Cache-Control no-cache; } location /dash { # Serve DASH fragments proxy_cache dash; proxy_ignore_headers Cache-Control; proxy_cache_valid any 30m; proxy_pass http://streming-server.tld$request_uri; add_header Cache-Control no-cache; } } }