From 2b5deb81f5656be6db4198b57d1dbe963185bf9b Mon Sep 17 00:00:00 2001 From: szaimen Date: Tue, 20 Sep 2022 18:16:17 +0200 Subject: [PATCH] bring Apache limits in sync with PHP limits Signed-off-by: szaimen --- Containers/apache/nextcloud.conf | 8 +++++++- manual-install/update-yaml.sh | 1 + php/containers.json | 4 +++- php/src/Data/ConfigurationManager.php | 5 +++++ php/src/Docker/DockerActionManager.php | 2 ++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Containers/apache/nextcloud.conf b/Containers/apache/nextcloud.conf index d701a264..530d26ff 100644 --- a/Containers/apache/nextcloud.conf +++ b/Containers/apache/nextcloud.conf @@ -26,5 +26,11 @@ Listen 8000 SetEnv proxy-sendcl 1 # See https://httpd.apache.org/docs/current/en/mod/core.html#limitrequestbody - LimitRequestBody 0 + LimitRequestBody ${APACHE_MAX_SIZE} + + # See https://httpd.apache.org/docs/current/mod/core.html#timeout + Timeout ${APACHE_MAX_TIME} + + # See https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxytimeout + ProxyTimeout ${APACHE_MAX_TIME} diff --git a/manual-install/update-yaml.sh b/manual-install/update-yaml.sh index 3cf23451..65a6c347 100644 --- a/manual-install/update-yaml.sh +++ b/manual-install/update-yaml.sh @@ -63,6 +63,7 @@ sed -i 's|COLLABORA_DICTIONARIES=|COLLABORA_DICTIONARIES=de_DE en_GB en_US es_ES sed -i 's|NEXTCLOUD_DATADIR=|NEXTCLOUD_DATADIR=nextcloud_aio_nextcloud_data # You can change this to e.g. "/mnt/ncdata" to map it to a location on your host. It needs to be adjusted before the first startup and never afterwards!|' sample.conf sed -i 's|NEXTCLOUD_MOUNT=|NEXTCLOUD_MOUNT=/mnt/ # This allows the Nextcloud container to access directories on the host. It must never be equal to the value of NEXTCLOUD_DATADIR!|' sample.conf sed -i 's|NEXTCLOUD_UPLOAD_LIMIT=|NEXTCLOUD_UPLOAD_LIMIT=10G # This allows to change the upload limit of the Nextcloud container|' sample.conf +sed -i 's|APACHE_MAX_SIZE=|APACHE_MAX_SIZE=10737418240 # This needs to be an integer and in sync with NEXTCLOUD_UPLOAD_LIMIT|' sample.conf sed -i 's|NEXTCLOUD_MAX_TIME=|NEXTCLOUD_MAX_TIME=3600 # This allows to change the upload time limit of the Nextcloud container|' sample.conf sed -i 's|UPDATE_NEXTCLOUD_APPS=|UPDATE_NEXTCLOUD_APPS=no # When setting to yes, it will automatically update all installed Nextcloud apps upon container startup on saturdays.|' sample.conf sed -i 's|APACHE_PORT=|APACHE_PORT=443 # Changing this to a different value than 443 will allow you to run it behind a reverse proxy.|' sample.conf diff --git a/php/containers.json b/php/containers.json index 879c4521..1bf889c7 100644 --- a/php/containers.json +++ b/php/containers.json @@ -24,7 +24,9 @@ "TALK_HOST=nextcloud-aio-talk", "APACHE_PORT=%APACHE_PORT%", "ONLYOFFICE_HOST=nextcloud-aio-onlyoffice", - "TZ=%TIMEZONE%" + "TZ=%TIMEZONE%", + "APACHE_MAX_SIZE=%APACHE_MAX_SIZE%", + "APACHE_MAX_TIME=%NEXTCLOUD_MAX_TIME%" ], "volumes": [ { diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 2ebcf53e..a656c84c 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -524,6 +524,11 @@ class ConfigurationManager return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); } + public function GetApacheMaxSize() : int { + $uploadLimit = (int)rtrim($this->GetNextcloudUploadLimit(), 'G'); + return $uploadLimit * 1024 * 1024 * 1024; + } + public function GetNextcloudMaxTime() : string { $envVariableName = 'NEXTCLOUD_MAX_TIME'; $configName = 'nextcloud_max_time'; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 74cb4a96..f02e1277 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -322,6 +322,8 @@ class DockerActionManager } } elseif ($out[1] === 'BORGBACKUP_HOST_LOCATION') { $replacements[1] = $this->configurationManager->GetBorgBackupHostLocation(); + } elseif ($out[1] === 'APACHE_MAX_SIZE') { + $replacements[1] = $this->configurationManager->GetApacheMaxSize(); } else { $replacements[1] = $this->configurationManager->GetSecret($out[1]); }