Skip to content
Snippets Groups Projects
Commit 4b44c7c3 authored by Florent Thiery's avatar Florent Thiery
Browse files

use caching in msuser vhost, fixes #18553

parent 4be100e0
No related branches found
No related tags found
No related merge requests found
# for a 20 Mbits/s stream, we want to keep maybe 10s of video, 40 streams means 1 GB
proxy_cache_path /tmp levels=1:2 keys_zone=livecache:10m max_size=2g inactive=30s;
geo $msuser_whitelist {
default 0;
127.0.0.1 1;
......@@ -54,8 +57,30 @@ server {
add_header Pragma public;
add_header Cache-Control "public";
}
location /streaming/ {
proxy_pass http://localhost:1935/live/;
location ~ ^/streaming/.*\.m3u8.*$ {
rewrite ^/streaming/(.*)$ /live/$1 break;
proxy_pass http://localhost:1935;
proxy_cache livecache;
proxy_cache_lock on;
expires -1;
proxy_cache_min_uses 1;
proxy_cache_valid 200 1s;
add_header X-Cache $upstream_cache_status;
add_header Access-Control-Allow-Origin "*";
proxy_cache_key $scheme$proxy_host$uri;
proxy_cache_use_stale updating;
}
location ~ /streaming/.*\.(ts).*$ {
rewrite ^/streaming/(.*)$ /live/$1 break;
proxy_pass http://localhost:1935;
proxy_cache livecache;
proxy_cache_lock on;
expires 2s;
proxy_cache_min_uses 1;
proxy_cache_valid 200 10s;
add_header X-Cache $upstream_cache_status;
add_header Access-Control-Allow-Origin "*";
proxy_cache_key $scheme$proxy_host$uri;
}
location / {
uwsgi_pass unix:///home/msuser/mstmp/uwsgi.sock;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment