+ proxy_pass http://backend;
+ }
+
+ location / {
+ try_files /dev/null @api;
+ }
+
+ location ~ ^/api/v1/(videos|video-playlists|users/me/avatar/pick)$ {
+ client_max_body_size 3M; # default is 1M
+ add_header X-File-Maximum-Size 2M always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
+
+ try_files /dev/null @api;
+ }
+
+ location = /api/v1/videos/upload {
+ limit_except POST HEAD { deny all; }
+
+ # This is the maximum upload size, which roughly matches the maximum size of a video file.
+ # Note that temporary space is needed equal to the total size of all concurrent uploads.
+ # This data gets stored in /var/lib/nginx by default, so you may want to put this directory
+ # on a dedicated filesystem.
+ client_max_body_size 12G; # default is 1M
+ add_header X-File-Maximum-Size 8G always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
+
+ try_files /dev/null @api;
+ }
+
+ ##
+ # Websocket
+ ##
+
+ location @api_websocket {
+ proxy_http_version 1.1;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+
+ proxy_pass http://backend;
+ }
+
+ location /socket.io {
+ try_files /dev/null @api_websocket;
+ }
+
+ location /tracker/socket {
+ # Peers send a message to the tracker every 15 minutes
+ # Don't close the websocket before then
+ proxy_read_timeout 15m; # default is 60s
+
+ try_files /dev/null @api_websocket;