nginx-rtmp-module
nginx-rtmp-module copied to clipboard
m3u8 cache problem
Hello,
the m3u8 run as the image and stop after every part
also after load 18.ts then load 19.ts but it's load 15.ts again.

please i want help to understand what the problem.
[vhost] stream.shof.live.ssl.conf
server {
listen 212.83.170.180:443 ssl;
server_name stream.shof.live www.stream.shof.live;
root /home/shoflive/public_html;
index index.php index.html index.htm;
access_log /usr/local/apache/domlogs/stream.shof.live.bytes bytes;
access_log /usr/local/apache/domlogs/stream.shof.live.log combined;
error_log /usr/local/apache/domlogs/stream.shof.live.error.log error;
ssl_certificate /etc/pki/tls/certs/stream.shof.live.bundle;
ssl_certificate_key /etc/pki/tls/private/stream.shof.live.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA!RC4:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
location / {
add_header Strict-Transport-Security "max-age=31536000";
add_header X-Content-Type-Options nosniff;
location ~.*\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)\$ {
proxy_cache off;
# kill cache
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
keepalive_timeout 0;
add_header Cache-Control no-store;
add_header Cache-Control no-cache;
add_header 'Access-Control-Allow-Origin' '*';
}
location ~.*\.(ts|m3u8)\$ {
proxy_cache off;
# kill cache
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
keepalive_timeout 0;
add_header Cache-Control no-store;
add_header Cache-Control no-cache;
add_header 'Access-Control-Allow-Origin' '*';
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/opt/alt/php-fpm72/usr/var/sockets/shoflive.sock;
fastcgi_index index.php;
include /usr/local/nginx/conf/fastcgi_params;
}
}
location /streambox1 {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
text/x-cross-domain-policy xml;
image/png png;
video/mp4 mp4;
}
root /mnt/;
add_header X-Cache-Status $upstream_cache_status;
add_header 'Access-Control-Allow-Origin' '*';
}
location /streambox {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /mnt/;
# kill cache
proxy_cache off;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
keepalive_timeout 0;
add_header Cache-Control no-store;
add_header Cache-Control no-cache;
add_header 'Access-Control-Allow-Origin' '*';
}
location ~* "/\.(htaccess|htpasswd)$" {deny all;return 404;}
disable_symlinks if_not_owner from=/home/shoflive/public_html;
location /.well-known/acme-challenge {
default_type "text/plain";
alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
}
}
nginx.conf
user nobody;
worker_processes auto;
#worker_rlimit_nofile 65535;
error_log /usr/local/nginx/logs/error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
load_module modules/ngx_http_modsecurity_module.so;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_header_timeout 3m;
client_body_timeout 3m;
client_max_body_size 256m;
client_header_buffer_size 4k;
client_body_buffer_size 256k;
large_client_header_buffers 4 32k;
send_timeout 3m;
keepalive_timeout 60 60;
reset_timedout_connection on;
server_names_hash_max_size 1024;
server_names_hash_bucket_size 1024;
ignore_invalid_headers on;
connection_pool_size 256;
request_pool_size 4k;
output_buffers 4 32k;
postpone_output 1460;
include mime.types;
default_type application/octet-stream;
# Compression gzip
gzip on;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
gzip_proxied any;
gzip_min_length 512;
gzip_comp_level 6;
gzip_buffers 8 64k;
gzip_types text/plain text/xml text/css text/js application/x-javascript application/xml image/png image/x-icon image/gif image/jpeg image/svg+xml application/xml+rss text/javascript application/atom+xml application/javascript application/json application/x-font-ttf font/opentype;
# Proxy settings
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;
proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=512m;
proxy_cache_key "$host$request_uri $cookie_user";
proxy_temp_path /var/cache/nginx/temp;
proxy_ignore_headers Expires Cache-Control;
proxy_cache_use_stale error timeout invalid_header http_502;
proxy_cache_valid any 1d;
open_file_cache_valid 120s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
open_file_cache max=5000 inactive=30s;
open_log_file_cache max=1024 inactive=30s min_uses=2;
# SSL Settings
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA!RC4:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS";
# Logs
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format bytes '$body_bytes_sent';
#access_log /var/log/nginx/access.log main;
access_log off;
# Cache bypass
map $http_cookie $no_cache {
default 0;
~SESS 1;
~wordpress_logged_in 1;
}
# Include additional configuration
include /usr/local/nginx/conf/cloudflare.inc;
include /usr/local/nginx/conf/conf.d/*.conf;
}
rtmp {
server {
listen 1935;
#chunk_size 4000;
# HLS
# For HLS to work please create a directory in tmpfs (/tmp/hls here)
# for the fragments. The directory contents is served via HTTP (see
# http{} section in config)
#
# Incoming stream must be in H264/AAC. For iPhones use baseline H264
# profile (see ffmpeg example).
# This example creates RTMP stream from movie ready for HLS:
#
# ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264
# -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1
# -f flv rtmp://cody.ws:2935/hls/movie
#
# If you need to transcode live stream use 'exec' feature.
#
application tvshow {
live on;
# Turn on HLS
hls on;
hls_path /mnt/tvshow/;
hls_fragment 5s;
hls_playlist_length 60s;
hls_sync 100ms;
hls_nested on;
hls_continuous on;
# disable consuming the stream from nginx as rtmp
deny play all;
#ffplay http://nasaiptv.com:8000/asadadasd/hnaoP0SdF9/33;
}
application show {
live on;
hls on;
hls_nested on;
hls_path /mnt/streambox1/;
hls_base_url https://stream.shof.live/streambox1/;
hls_fragment 5s;
hls_playlist_length 15s;
publish_notify on;
hls_continuous on;
play_restart on;
idle_streams on;
drop_idle_publisher 10s;
# disable consuming the stream from nginx as rtmp
deny play all;
}
application tvshow1 {
live on;
# Turn on HLS
hls on;
play_restart on;
hls_path /mnt/streambox/;
hls_base_url https://stream.shof.live/streambox/;
#hls_fragment_naming system;
#hls_fragment_slicing aligned;
#hls_fragment_naming_granularity 500;
hls_fragment 5s;
hls_playlist_length 60s;
#on_update http://shof.live/;
hls_sync 100ms;
hls_nested on;
# disable consuming the stream from nginx as rtmp
deny play all;
}
# MPEG-DASH is similar to HLS
application dash {
live on;
dash on;
dash_path /tmp/dash;
}
}
}
Hello, have you found a fix?