diff --git a/conf/nginx.conf b/conf/nginx.conf index 66afd4e..a90e797 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,7 @@ more_set_headers "X-Frame-Options : ALLOWALL"; # Bypass PeerTube for performance reasons. Could be removed -location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ { +location ~ ^/client/(.*\.(js|css|png|svg|woff2|otf|ttf|woff|eot))$ { add_header Cache-Control "public, max-age=31536000, immutable"; alias __FINALPATH__/client/dist/$1; @@ -52,6 +52,7 @@ location / { # on a dedicated filesystem. # client_max_body_size 8G; + proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; @@ -62,9 +63,20 @@ location / { } # Bypass PeerTube for performance reasons. Could be removed -location ~ ^/static/(webseed|redundancy)/ { +location ~ ^/static/(webseed|redundancy|streaming-playlists)/ { # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client - limit_rate 800k; + set $peertube_limit_rate 800k; + + # Increase rate limit in HLS mode, because we don't have multiple simultaneous connections + if ($request_uri ~ -fragmented.mp4$) { + set $peertube_limit_rate 5000k; + } + + # Use this with nginx >= 1.17.0 + # limit_rate $peertube_limit_rate; + # Or this if your nginx < 1.17.0 + set $limit_rate $peertube_limit_rate; + limit_rate_after 5000k; if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; @@ -89,6 +101,7 @@ location ~ ^/static/(webseed|redundancy)/ { rewrite ^/static/webseed/(.*)$ /videos/$1 break; rewrite ^/static/redundancy/(.*)$ /redundancy/$1 break; + rewrite ^/static/streaming-playlists/(.*)$ /streaming-playlists/$1 break; try_files $uri /; }