"413 Request Entity Too Large" when uploading big files, even with a config that should support them

Nextcloud version: 30.0.1
Nextcloud desktop client: 3.14.2
Operating system and version: Ubuntu 20.04 focal
Apache or nginx version: nginx 1.18.0
PHP version : 8.3

The issue you are facing:

I get errors “413 Request Entity Too Large” when uploading files using the Nextcloud desktop client. It seems that files > 100MB can’t be uploaded and I get this error.

I’ve already tried messing with the parameters recommended in Uploading big files > 512MB — Nextcloud latest Administration Manual latest documentation to increase the max upload size (check my php, nginx and nextcloud configs below) but it still seems to not be working.

Is this the first time you’ve seen this error?

No. Previously I has able to fix the issue using the recommended configurations, that don’t seem to be working now.

Steps to replicate it:

  1. Add some big files to a folder
  2. Let the desktop client try to sync them
  3. Get error messages in the desktop client saying files couldn’t be synced

Configs:

Logs:

  • The output of your Nextcloud log in Admin > Logging: No logs for the period of the uploads
  • PHP logs (/var/log/php8.3-fpm.log): No logs for the period of the upload
  • nginx access logs during the uploads: https://pastebin.com/BdPzDA14
  • nginx error logs: no error logs during the uploads

Hi @andresantos,

Which php.ini is that?

(exact path please)

because there are more than one.

For your web server nginx only the php.ini from the subdirectory fpm of your php version is responsible.

So if your php Version is 8.3, then it is

/etc/php/8.3/fpm/php.ini

… and is only one php installed?

If you have more than one php installed, what is the output of this query:

for socket in $(ss -lx | awk '/fpm/{print $5}'); do
    echo "socket: $socket"
    grep -Els "^[^#]*$socket" $(nginx -T 2>/dev/null) | sort -u
done

Much and good luck,
ernolf

Are you using Cloudflare’s free service level? If so, that’s why.

2 Likes

/etc/php/8.3/fpm/php.ini

No, I have other versions. But I stopped and disabled the service for all of them and made sure only 8.3 is enabled.

Running it as is gives me this:

socket: /run/php/php-fpm.sock
grep: unrecognized option '--enable-force-cgi-redirect'
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.

But I assume what you want with this is to check if my nginx config mentions the php socket /run/php/php-fpm.sock.

In the nginx config I posted previously, you can see a php-handler mentioned, which is defined as follow:

upstream php-handler {
    server unix:/run/php/php-fpm.sock;
}

I know PHP creates a socket for each version. But since I just have one version of php active at a given time, I usually override the listen setting in the php config (/etc/php/8.3/fpm/pool.d/www.conf):

listen = /run/php/php-fpm.sock

I do use Cloudfare free service level, so this seems very plausible actually!

I have Nextcloud on a subdomain. I’m trying to setup cloudflare to just provide DNS services for the subdomain where cloudflare is. Not working for now, but I’ll keep investigating the issue being Cloudflare.

1 Like

Yeah, that was it! I made the subdomain to be unproxied, cleared all the DNS caches, and after waiting a bit the uploads succeeded!

As a next step, I might try the subdomain to be proxied again, but change the configs to chunk the downloads in chunks of < 100MB.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.