Hi. I have a 17.3GB file, in NGINX config I increased the download time and download size options
location @api {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100k; # default is 1M
proxy_connect_timeout 15m;
proxy_send_timeout 15m;
proxy_read_timeout 15m;
send_timeout 15m;
proxy_pass http://backend;
}
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 20G; # 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 $
try_files /dev/null @api;
}
I rebooted the NGINX service and am trying to add this file to the server. After a while I see an error
But the file itself has been added and is being processed. I don’t know the result yet.
I checked the NGINX logs and Peertube logs, but I did not find any errors related to this problem.
Tell me how to fix this problem, or did I do something wrong?
You need to increase client_max_body_size size on nginx config.
Sets the maximum allowed size of the client request body. If the size in a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client. Please be aware that browsers cannot correctly display this error. Setting size to 0 disables checking of client request body size.
location @api {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 2G; # default is 1M
proxy_connect_timeout 10m;
proxy_send_timeout 10m;
proxy_read_timeout 10m;
send_timeout 10m;
proxy_pass http://backend;
}
location / {
try_files /dev/null @api;
}
location = /api/v1/videos/upload-resumable {
client_max_body_size 2G;
proxy_request_buffering off;
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 2G; # default is 1M
add_header X-File-Maximum-Size 2G 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|video-playlists|video-channels|users/me) {
client_max_body_size 2G; # default is 1M
add_header X-File-Maximum-Size 2G always; # inform backend of the set value in bytes before mime-encoding (x * 1.4 >= client_max_body_size)
try_files /dev/null @api;
}
In case something does not work as expected, you may try to find out the reason in access.log and error.log files in the directory /usr/local/nginx/logs or /var/log/nginx .
I have possibly the same issue: importing from YouTube works as expected, but uploading a file does not. I immediately get the error « the server encountered an error ».
I have added the client_max_body_size 5G; line to my /etc/nginx/nginx.conf file, but to no avail. What else could be going on here?
Perhaps you are using an additional proxy server through which you redirect requests to the Peertube server, for example using proxy_pass? If so, then on the proxy server it is also necessary to increase the size of requests.
Now, I’m a bit clueless about where to look for that. I do have proxy_pass in my peertube nginx config, but I’m not sure where that leads to. How do I find out?