diff options
Diffstat (limited to 'support/nginx')
-rw-r--r-- | support/nginx/peertube | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/support/nginx/peertube b/support/nginx/peertube index a1cdc2221..a278524ba 100644 --- a/support/nginx/peertube +++ b/support/nginx/peertube | |||
@@ -120,6 +120,19 @@ server { | |||
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|streaming-playlists)/ { | 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 | set $peertube_limit_rate 800k; | ||
125 | |||
126 | # Increase rate limit in HLS mode, because we don't have multiple simultaneous connections | ||
127 | if ($request_uri ~ -fragmented.mp4$) { | ||
128 | set $peertube_limit_rate 5000k; | ||
129 | } | ||
130 | |||
131 | # Use this with nginx >= 1.17.0 | ||
132 | # limit_rate $peertube_limit_rate; | ||
133 | # Or this if your nginx < 1.17.0 | ||
134 | set $limit_rate $peertube_limit_rate; | ||
135 | limit_rate_after 5000k; | ||
123 | 136 | ||
124 | if ($request_method = 'OPTIONS') { | 137 | if ($request_method = 'OPTIONS') { |
125 | add_header 'Access-Control-Allow-Origin' '*'; | 138 | add_header 'Access-Control-Allow-Origin' '*'; |
@@ -140,20 +153,6 @@ server { | |||
140 | access_log off; | 153 | access_log off; |
141 | } | 154 | } |
142 | 155 | ||
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 | |||
157 | root /var/www/peertube/storage; | 156 | root /var/www/peertube/storage; |
158 | 157 | ||
159 | rewrite ^/static/webseed/(.*)$ /videos/$1 break; | 158 | rewrite ^/static/webseed/(.*)$ /videos/$1 break; |