diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index f4e97fe0..0a9484d4 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -73,7 +73,9 @@ RUN set -ex; \ apk del .build-deps # set recommended PHP.ini settings -# see https://docs.nextcloud.com/server/12/admin_manual/configuration_server/server_tuning.html#enable-php-opcache +# see https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache +ENV PHP_MEMORY_LIMIT 512M +ENV PHP_UPLOAD_LIMIT 512M RUN { \ echo 'opcache.enable=1'; \ echo 'opcache.interned_strings_buffer=8'; \ @@ -85,7 +87,11 @@ RUN { \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ \ - echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \ + { \ + echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ + echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ + echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \ + } > /usr/local/etc/php/conf.d/nextcloud.ini; \ \ mkdir /var/www/data; \ chown -R www-data:root /var/www; \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index b3326df0..a6c4e215 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -16,6 +16,8 @@ RUN set -ex; \ # install the PHP extensions we need # see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html +ENV PHP_MEMORY_LIMIT 512M +ENV PHP_UPLOAD_LIMIT 512M RUN set -ex; \ \ savedAptMark="$(apt-mark showmanual)"; \ @@ -86,7 +88,7 @@ RUN set -ex; \ rm -rf /var/lib/apt/lists/* # set recommended PHP.ini settings -# see https://docs.nextcloud.com/server/12/admin_manual/configuration_server/server_tuning.html#enable-php-opcache +# see https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache RUN { \ echo 'opcache.enable=1'; \ echo 'opcache.interned_strings_buffer=8'; \ @@ -98,7 +100,11 @@ RUN { \ \ echo 'apc.enable_cli=1' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini; \ \ - echo 'memory_limit=512M' > /usr/local/etc/php/conf.d/memory-limit.ini; \ + { \ + echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ + echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ + echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \ + } > /usr/local/etc/php/conf.d/nextcloud.ini; \ \ mkdir /var/www/data; \ chown -R www-data:root /var/www; \ diff --git a/README.md b/README.md index 76d91af4..a346e23f 100644 --- a/README.md +++ b/README.md @@ -182,6 +182,10 @@ To use an external OpenStack Swift object store as primary storage, set the foll Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#openstack-swift) for more information. +To customize other PHP limits you can simply change the following variables: +- `PHP_INI_MEMORY_LIMIT` (default `512M`) This sets the maximum amount of memory in bytes that a script is allowed to allocate. This is meant to help prevent poorly written scripts from eating up all available memory but it can prevent normal operation if set too tight. +- `PHP_UPLOAD_LIMIT` (default `512M`) This sets the upload limit (`post_max_size` and `upload_max_filesize`) for big files. Note that you may have to change other limits depending on your client, webserver or operating system. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html) for more information. + ## Using the apache image behind a reverse proxy and auto configure server host and protocol