aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/nginx
diff options
context:
space:
mode:
Diffstat (limited to 'support/nginx')
-rw-r--r--support/nginx/peertube19
1 files changed, 16 insertions, 3 deletions
diff --git a/support/nginx/peertube b/support/nginx/peertube
index 05f172280..a1cdc2221 100644
--- a/support/nginx/peertube
+++ b/support/nginx/peertube
@@ -119,9 +119,7 @@ server {
119 } 119 }
120 120
121 # Bypass PeerTube for performance reasons. Could be removed 121 # Bypass PeerTube for performance reasons. Could be removed
122 location ~ ^/static/(webseed|redundancy)/ { 122 location ~ ^/static/(webseed|redundancy|streaming-playlists)/ {
123 # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
124 limit_rate 800k;
125 123
126 if ($request_method = 'OPTIONS') { 124 if ($request_method = 'OPTIONS') {
127 add_header 'Access-Control-Allow-Origin' '*'; 125 add_header 'Access-Control-Allow-Origin' '*';
@@ -142,10 +140,25 @@ server {
142 access_log off; 140 access_log off;
143 } 141 }
144 142
143 # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
144 set $peertube_limit_rate 800k;
145
146 # Increase rate limit in HLS mode, because we don't have multiple simultaneous connections
147 if ($request_uri ~ -fragmented.mp4$) {
148 set $peertube_limit_rate 5000k;
149 }
150
151 # Use this with nginx >= 1.17.0
152 # limit_rate $peertube_limit_rate;
153 # Or this if your nginx < 1.17.0
154 set $limit_rate $peertube_limit_rate;
155 limit_rate_after 5000k;
156
145 root /var/www/peertube/storage; 157 root /var/www/peertube/storage;
146 158
147 rewrite ^/static/webseed/(.*)$ /videos/$1 break; 159 rewrite ^/static/webseed/(.*)$ /videos/$1 break;
148 rewrite ^/static/redundancy/(.*)$ /redundancy/$1 break; 160 rewrite ^/static/redundancy/(.*)$ /redundancy/$1 break;
161 rewrite ^/static/streaming-playlists/(.*)$ /streaming-playlists/$1 break;
149 162
150 try_files $uri /; 163 try_files $uri /;
151 } 164 }