Skip to content
Snippets Groups Projects

maybe fixed nginx caching config

Merged yids requested to merge caching-nginx into develop
@@ -99,27 +99,47 @@ rtmp {
http {
access_log /dev/stdout combined;
map $request_uri $cache_expires {
default 59;
~*(.+\.ts)$ 3600;
~*(.+\.m3u8)$ 10;
}
map $request_uri $cache_control {
default "public , s-maxage=59, max-age=59";
~*(.+\.ts)$ "immutable , s-maxage=3600, max-age=3600";
~*(.+\.m3u8)$ "public, s-maxage=10, max-age=10";
}
server {
listen 80;
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /opt/data;
add_header Cache-Control no-cache;
add_header Cache-Control $cache_control;
add_header Expires $cache_expires;
add_header X-Cache-Control $cache_control;
add_header X-Expires $cache_expires;
add_header Access-Control-Allow-Origin *;
}
location /live {
alias /opt/data/hls;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
alias /opt/data/hls;
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
add_header Cache-Control $cache_control;
add_header Expires $cache_expires;
add_header X-Cache-Control $cache_control;
add_header X-Expires $cache_expires;
add_header Access-Control-Allow-Origin *;
}
location /stat {
Loading