Enable caching for videos

This commit is contained in:
Felix Ableitner 2019-04-19 02:57:19 +02:00
parent 27626051bf
commit ae2de6339f
3 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[peertube] [peertube]
root@testing.peertube.social domain=testing.peertube.social root@testing.peertube.social domain=testing.peertube.social
felix@peertube.social domain=peertube.social #felix@peertube.social domain=peertube.social
[all:vars] [all:vars]
ansible_connection=ssh ansible_connection=ssh

View File

@ -8,5 +8,5 @@ PEERTUBE_SMTP_FROM=info@{{ domain }}
PEERTUBE_SMTP_TLS=false PEERTUBE_SMTP_TLS=false
PEERTUBE_ADMIN_EMAIL=info@{{ domain }} PEERTUBE_ADMIN_EMAIL=info@{{ domain }}
POSTGRES_USER=postgres POSTGRES_USER=peertube
POSTGRES_PASSWORD={{ postgres_password }} POSTGRES_PASSWORD={{ postgres_password }}

View File

@ -3,7 +3,7 @@ events {
} }
http { http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=peertube_cache:10m max_size=15g inactive=7d use_temp_path=off; proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=peertube_cache:10m max_size=15g use_temp_path=off;
server { server {
listen 9000; listen 9000;
@ -46,5 +46,18 @@ http {
proxy_cache_lock on; proxy_cache_lock on;
add_header X-Cached $upstream_cache_status; add_header X-Cached $upstream_cache_status;
} }
location ~ ^/static/(webseed|redundancy)/ {
slice 1m;
proxy_cache peertube_cache;
proxy_cache_valid 206 1h;
proxy_cache_key $uri$is_args$args$slice_range;
proxy_set_header Range $slice_range;
# for debugging
#add_header X-Cache-Status $upstream_cache_status;
proxy_http_version 1.1;
# required workaround for https://github.com/Chocobozzz/PeerTube/issues/1777
proxy_ignore_headers Cache-Control;
proxy_pass http://peertube:9000;
}
} }
} }