Nextcloud issue: Download fails on large file

Hey all. I sent a download link from my nextcloud server to a friend, but it failed several times. I think it has to do with the file size, which was over 1.5GB, but I’m new to all this and I don’t know where to change the size limit.

For reference, I’m running NC as a TrueNAS jail and using NGINX proxy manager running in a docker container as the proxy. The files are all located on mounted external storage, which is my TrueNAS pool.

Any help would be much appreciated, thanks!

As in its failing to download? What specific error?

It just says download failed at or around 1GB

Can you please post your nginx config to pastebin or something?

You could try bumping the PHP execution limit as well, just in case that is what is causing the problem. Without logs its difficult to troubleshoot remotely.

I’ve heard this suggested before! Do you happen to know where I can find the PHP file to change this setting?

Depends on how you set it up, but you are looking for a php.ini file in /etc/php.

If you are using PHP 8.1 and PHP-FPM for example, it would be in /etc/php/8.1/fpm/php.ini.

You are looking for this directive:

; Maximum execution time of each script, in seconds
; https://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30

That is the timeout in seconds for execution. Try bumping that to something like 120.

– EDIT –

Also, take a look at the error logs. If you are using Nginx it would be /var/log/nginx/error_log I believe.

Yep, not an expert on PHP, but there should be some error logs somewhere it (PHP) writes in addition to nginx. HTTP protocol sends a status back to the browser before headers and before data starts - looking at the reply client side won’t be useful, it’ll almost always be reporting 200 success.

There also used to be an option ages ago (xsendfile x-accel-redirect) where PHP would hand over an open file descriptor and the HTTP webserver outside of PHP would take care of copying bytes onto the socket without having to involve PHP further. You should be able to tell from the nginx config whether it’s configured.

Thanks for the reply!

So when I go inside:

mnt/[my pool]/iocage/jails/NextCloud/root/usr/local/etc

I see (among other things):

php.ini-development
php.ini-production

Are these the ones you’re referring to? I imagine production would be the one I’d need to change.

There’s also a php folder in /etc, but nothing called php.ini, all the files have names like “ext-10-opcache.ini”

That sounds like a good place to start

Reviving this to update for anyone in the future with the same problem.
Inside the nginx proxy manager advanced settings, I put:

client_max_body_size 0;
proxy_max_temp_file_size 0;

This solved the issue. Unfortunately my client’s download speeds on file shares are only 100kb/s, no idea if that’s related or not! But at least the other problem is resolved.

1 Like