Loading nixos/modules/services/web-apps/nextcloud.md +10 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,16 @@ release notes when upgrading. services.nextcloud.phpOptions."realpath_cache_size" = "0"; ``` - **Empty Files on chunked uploads** Due to a limitation of PHP-FPM, Nextcloud is unable to handle chunked uploads. See upstream issue [nextcloud/server#7995](https://github.com/nextcloud/server/issues/7995) for details. A workaround is to disable chunked uploads with {option}`nextcloud.nginx.enableFastcgiRequestBuffering`. ## Using an alternative webserver as reverse-proxy (e.g. `httpd`) {#module-services-nextcloud-httpd} By default, `nginx` is used as reverse-proxy for `nextcloud`. Loading nixos/modules/services/web-apps/nextcloud.nix +18 −1 Original line number Diff line number Diff line Loading @@ -986,6 +986,23 @@ in directive and header. ''; }; enableFastcgiRequestBuffering = mkOption { type = types.bool; default = false; description = '' Whether to buffer requests against fastcgi requests. This is a workaround for `PUT` requests with the `Transfer-Encoding: chunked` header set and an unspecified `Content-Length`. Without request buffering for these requests, Nextcloud will create files with zero bytes length as described in [nextcloud/server#7995](https://github.com/nextcloud/server/issues/7995). ::: {.note} Please keep in mind that upstream suggests to not enable this as it might lead to timeouts on large files being uploaded as described in the [administrator manual](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html#nginx). ::: ''; }; }; cli.memoryLimit = mkOption { Loading Loading @@ -1476,7 +1493,7 @@ in fastcgi_param front_controller_active true; fastcgi_pass unix:${fpm.socket}; fastcgi_intercept_errors on; fastcgi_request_buffering off; fastcgi_request_buffering ${if cfg.nginx.enableFastcgiRequestBuffering then "on" else "off"}; fastcgi_read_timeout ${builtins.toString cfg.fastcgiTimeout}s; ''; }; Loading nixos/tests/nextcloud/basic.nix +13 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ runTest ( startAt = "20:00"; }; phpExtraExtensions = all: [ all.bz2 ]; nginx.enableFastcgiRequestBuffering = true; }; specialisation.withoutMagick.configuration = { Loading Loading @@ -90,6 +91,7 @@ runTest ( nexcloudWithImagick = findInClosure "imagick" nodes.nextcloud.system.build.vm; nextcloudWithoutImagick = findInClosure "imagick" nodes.nextcloud.specialisation.withoutMagick.configuration.system.build.vm; in # python '' with subtest("File is in proper nextcloud home"): nextcloud.succeed("test -f ${nodes.nextcloud.services.nextcloud.datadir}/data/root/files/test-shared-file") Loading @@ -103,6 +105,17 @@ runTest ( with subtest("Ensure SSE is disabled by default"): nextcloud.succeed("grep -vE '^HBEGIN:oc_encryption_module' /var/lib/nextcloud-data/data/root/files/test-shared-file") with subtest("Create non-empty files with Transfer-Encoding: chunked"): client.succeed( 'dd if=/dev/urandom of=testfile.bin bs=1M count=10', 'curl --fail -v -X PUT --header "Transfer-Encoding: chunked" --data-binary @testfile.bin "http://nextcloud/remote.php/webdav/testfile.bin" -u ${config.adminuser}:${config.adminpass}', ) # Verify the local and remote copies of the file are identical. client_hash = client.succeed("nix-hash testfile.bin").strip() nextcloud_hash = nextcloud.succeed("nix-hash /var/lib/nextcloud-data/data/root/files/testfile.bin").strip() t.assertEqual(client_hash, nextcloud_hash) ''; } ) Loading
nixos/modules/services/web-apps/nextcloud.md +10 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,16 @@ release notes when upgrading. services.nextcloud.phpOptions."realpath_cache_size" = "0"; ``` - **Empty Files on chunked uploads** Due to a limitation of PHP-FPM, Nextcloud is unable to handle chunked uploads. See upstream issue [nextcloud/server#7995](https://github.com/nextcloud/server/issues/7995) for details. A workaround is to disable chunked uploads with {option}`nextcloud.nginx.enableFastcgiRequestBuffering`. ## Using an alternative webserver as reverse-proxy (e.g. `httpd`) {#module-services-nextcloud-httpd} By default, `nginx` is used as reverse-proxy for `nextcloud`. Loading
nixos/modules/services/web-apps/nextcloud.nix +18 −1 Original line number Diff line number Diff line Loading @@ -986,6 +986,23 @@ in directive and header. ''; }; enableFastcgiRequestBuffering = mkOption { type = types.bool; default = false; description = '' Whether to buffer requests against fastcgi requests. This is a workaround for `PUT` requests with the `Transfer-Encoding: chunked` header set and an unspecified `Content-Length`. Without request buffering for these requests, Nextcloud will create files with zero bytes length as described in [nextcloud/server#7995](https://github.com/nextcloud/server/issues/7995). ::: {.note} Please keep in mind that upstream suggests to not enable this as it might lead to timeouts on large files being uploaded as described in the [administrator manual](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html#nginx). ::: ''; }; }; cli.memoryLimit = mkOption { Loading Loading @@ -1476,7 +1493,7 @@ in fastcgi_param front_controller_active true; fastcgi_pass unix:${fpm.socket}; fastcgi_intercept_errors on; fastcgi_request_buffering off; fastcgi_request_buffering ${if cfg.nginx.enableFastcgiRequestBuffering then "on" else "off"}; fastcgi_read_timeout ${builtins.toString cfg.fastcgiTimeout}s; ''; }; Loading
nixos/tests/nextcloud/basic.nix +13 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ runTest ( startAt = "20:00"; }; phpExtraExtensions = all: [ all.bz2 ]; nginx.enableFastcgiRequestBuffering = true; }; specialisation.withoutMagick.configuration = { Loading Loading @@ -90,6 +91,7 @@ runTest ( nexcloudWithImagick = findInClosure "imagick" nodes.nextcloud.system.build.vm; nextcloudWithoutImagick = findInClosure "imagick" nodes.nextcloud.specialisation.withoutMagick.configuration.system.build.vm; in # python '' with subtest("File is in proper nextcloud home"): nextcloud.succeed("test -f ${nodes.nextcloud.services.nextcloud.datadir}/data/root/files/test-shared-file") Loading @@ -103,6 +105,17 @@ runTest ( with subtest("Ensure SSE is disabled by default"): nextcloud.succeed("grep -vE '^HBEGIN:oc_encryption_module' /var/lib/nextcloud-data/data/root/files/test-shared-file") with subtest("Create non-empty files with Transfer-Encoding: chunked"): client.succeed( 'dd if=/dev/urandom of=testfile.bin bs=1M count=10', 'curl --fail -v -X PUT --header "Transfer-Encoding: chunked" --data-binary @testfile.bin "http://nextcloud/remote.php/webdav/testfile.bin" -u ${config.adminuser}:${config.adminpass}', ) # Verify the local and remote copies of the file are identical. client_hash = client.succeed("nix-hash testfile.bin").strip() nextcloud_hash = nextcloud.succeed("nix-hash /var/lib/nextcloud-data/data/root/files/testfile.bin").strip() t.assertEqual(client_hash, nextcloud_hash) ''; } )