From 22af1a8bf9bb1cee3a1cd35458340662b77bf201 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 4 Sep 2025 12:23:17 +0200 Subject: [PATCH] fix(nginx): `fastcgi_request_buffering` must be `on` * resolves: https://github.com/nextcloud/documentation/issues/9574 Some clients like DAVx5 use chunked transfer encoding. PHP-FPM does not support this[1] because it requires to comply with the CGI standard - 20+ years old - which enforces a Content-Length header. So we need to buffer the whole request until passing it to PHP-FPM. Without this 0-byte files would be created on Nextcloud as PHP-FPM will not only set content-length to 0 but also does not pass the body data stream. [1] https://bugs.php.net/bug.php?id=51191 and https://github.com/php/php-src/pull/7509 Signed-off-by: Ferdinand Thiessen --- .../configuration_files/big_file_upload_configuration.rst | 6 ------ admin_manual/installation/nginx-root.conf.sample | 2 +- admin_manual/installation/nginx-subdir.conf.sample | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/admin_manual/configuration_files/big_file_upload_configuration.rst b/admin_manual/configuration_files/big_file_upload_configuration.rst index 241bd0023..f49d11ec7 100644 --- a/admin_manual/configuration_files/big_file_upload_configuration.rst +++ b/admin_manual/configuration_files/big_file_upload_configuration.rst @@ -94,12 +94,6 @@ nginx * `fastcgi_read_timeout `_ [often the solution to 504 timeouts during ``MOVE`` transactions that occur even when using chunking] * `client_body_temp_path `_ -Since nginx 1.7.11 a new config option `fastcgi_request_buffering -`_ -is available. Setting this option to ``fastcgi_request_buffering off;`` in your nginx config -might help with timeouts during the upload. Furthermore it helps if you're running out of -disc space on the tmp partition of your system. - .. note:: Make sure that ``client_body_temp_path`` points to a partition with adequate space for your upload file size, and on the same partition as the ``upload_tmp_dir`` or ``tempdirectory`` (see below). For optimal diff --git a/admin_manual/installation/nginx-root.conf.sample b/admin_manual/installation/nginx-root.conf.sample index c2aff0630..286c142aa 100644 --- a/admin_manual/installation/nginx-root.conf.sample +++ b/admin_manual/installation/nginx-root.conf.sample @@ -165,7 +165,7 @@ server { fastcgi_pass php-handler; fastcgi_intercept_errors on; - fastcgi_request_buffering off; + fastcgi_request_buffering on; # Required as PHP-FPM does not support chunked transfer encoding and requires a valid ContentLength header. fastcgi_max_temp_file_size 0; } diff --git a/admin_manual/installation/nginx-subdir.conf.sample b/admin_manual/installation/nginx-subdir.conf.sample index 5ad2eca1f..d85264f7b 100644 --- a/admin_manual/installation/nginx-subdir.conf.sample +++ b/admin_manual/installation/nginx-subdir.conf.sample @@ -162,7 +162,7 @@ server { fastcgi_pass php-handler; fastcgi_intercept_errors on; - fastcgi_request_buffering off; + fastcgi_request_buffering on; # Required as PHP-FPM does not support chunked transfer encoding and requires a valid ContentLength header. fastcgi_max_temp_file_size 0; }