Problem:
I’m running nextcloud on a home server behind an nginx proxy. When I try to upload large binary (~10mb) files, the upload fails. The upload succeeds if I upload the files via gnome files or the mobile app.
Attempted fix:
My initial thought was that nginx or php was rejecting the file because it was too large, so I added client_max_body_size 16G;
to nginx’s http, server, and location sections. I also ran
* snap set nextcloud php.post-max-execution-time=100000
* snap set php.upload-max-filesize 16G
* snap set php.post-max-size 16G
* snap set php.max-input-time 100000
* snap set php.max-execution-time 100000
Versions:
Nextcloud version: Nextcloud Snap 20.0.4
Operating system: Ubuntu Server 20.04
Nginx version: 1.18.0
Repro Steps:
- Install a clean copy of ubuntu 20.04
- Install Nextcloud Snap and and nginx
- Set up a reverse proxy to Nextcloud
- Attempt to upload a file
config.php file:
<?php
$CONFIG = array (
'apps_paths' =>
array (
0 =>
array (
'path' => '/snap/nextcloud/current/htdocs/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
'url' => '/extra-apps',
'writable' => true,
),
),
'supportedDatabases' =>
array (
0 => 'mysql',
),
'memcache.locking' => '\\OC\\Memcache\\Redis',
'memcache.local' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '/tmp/sockets/redis.sock',
'port' => 0,
),
'log_type' => 'file',
'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
'logfilemode' => 416,
'passwordsalt' => '<redacted>',
'secret' => '<redacted>',
'trusted_domains' =>
array (
0 => 'localhost',
1 => '<redacted>',
),
'trusted_proxies' =>
array (
0 => '127.0.0.1',
),
'datadirectory' => '<redacted>',
'dbtype' => '<redacted>',
'version' => '<redacted>',
'overwrite.cli.url' => '<redacted>',
'overwriteprotocol' => 'https',
'overwritehost' => '<redacted>',
'dbname' => '<redacted>',
'dbhost' => '<redacted>',
'dbport' => '',
'dbtableprefix' => '<redacted>',
'mysql.utf8mb4' => true,
'dbuser' => '<redacted>',
'dbpassword' => '<redacted>',
'installed' => true,
'instanceid' => '<redacted>',
'maintenance' => false,
'loglevel' => 2,
'app_install_overwrite' =>
array (
0 => '<redacted>',
1 => '<redacted>',
),
);
Relevent nginx logs:
146.115.145.110 - - [27/Dec/2020:18:31:37 +0000] "MKCOL /remote.php/dav/uploads/ajl/web-file-upload-373c038a410bb3edd463edde5843dd04-1609093897581 HTTP/1.1" 201 0 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
146.115.145.110 - - [27/Dec/2020:18:31:37 +0000] "PUT /remote.php/dav/uploads/ajl/web-file-upload-373c038a410bb3edd463edde5843dd04-1609093897581/0 HTTP/1.1" 400 0 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
146.115.145.110 - - [27/Dec/2020:18:31:37 +0000] "PUT /remote.php/dav/uploads/ajl/web-file-upload-373c038a410bb3edd463edde5843dd04-1609093897581/0 HTTP/1.1" 400 0 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
146.115.145.110 - - [27/Dec/2020:18:31:38 +0000] "DELETE /remote.php/dav/uploads/ajl/web-file-upload-373c038a410bb3edd463edde5843dd04-1609093897581 HTTP/1.1" 204 0 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
146.115.145.110 - - [27/Dec/2020:18:31:38 +0000] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2F HTTP/1.1" 200 202 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
Relevent apache snap logs:
127.0.0.1 - - [27/Dec/2020:18:45:00 +0000] "MKCOL /remote.php/dav/uploads/ajl/web-file-upload-373c038a410bb3edd463edde5843dd04-1609094700787 HTTP/1.0" 201 525 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
127.0.0.1 - - [27/Dec/2020:18:45:00 +0000] "POST /index.php/apps/text/session/sync HTTP/1.0" 200 959 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
127.0.0.1 - - [27/Dec/2020:18:45:01 +0000] "DELETE /remote.php/dav/uploads/ajl/web-file-upload-373c038a410bb3edd463edde5843dd04-1609094700787 HTTP/1.0" 204 469 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
127.0.0.1 - - [27/Dec/2020:18:45:01 +0000] "GET /index.php/apps/files/ajax/getstoragestats.php?dir=%2F HTTP/1.0" 200 930 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
I think the problem is those “PUT” requests that are returning 400. They appear in nginx logs, but don’t appear in the apache logs. I’m a little out of my depth here, though. Any advise would be greatly appreciated.