Changing the maximum upload file size with Nextcloud in a docker-compose setup
The Nextcloud documentation as of today does not mention how to adjust the settings for uploading large files when using Nextcloud in a docker-compose setup (or generally in a Docker container). It does mention, however, that the following PHP settings need to be adjusted:
php_value upload_max_filesize 16G php_value post_max_size 16G
So the issue is reduced to finding out how these values can be changed for the container running the Nextcloud image in the simplest way.
Most of the sites I found while trying to solve this recommend adding or changing an ini
file in the container (e.g. setting up a bind mount). But this can actually be solved in a much simpler and potentially less fragile way! Check out this excerpt from an nextcloud.ini
file inside the main Nextcloud container:
$ sudo docker exec -it nextcloud_app bash root@42b3ec8ee31f:/var/www/html# grep -E '(upload_max_filesize|post_max_size)' /usr/local/etc/php/conf.d/nextcloud.ini upload_max_filesize=${PHP_UPLOAD_LIMIT} post_max_size=${PHP_UPLOAD_LIMIT}
So the relevant settings are automatically adjusted when you set the PHP_UPLOAD_LIMIT
environment variable. You can easily do this in your docker-compose.yml
like this:
services: # ... app: image: nextcloud:apache container_name: nextcloud_app # ... environment: # ... - PHP_UPLOAD_LIMIT=16G # ...
Afterwards, the System page in Nextcloud’s administration menu should show something like this:
By the way: the reverse proxy that redirects client requests to the actual application container also has to support large file uploads. But this is already configured by default when using Nextcloud’s sample docker-compose setup.
Recent Posts
Recent Comments
- Arjun on Fix for Latex4CorelDraw with CorelDraw 2017
- Nigel De Gillern on No wired (LAN) connection in Linux, although everything looks right
- Harald H on Automatically reboot TP-Link router WDR4300 / N750 with bash script
- Gene on Running multiple Django projects on one Apache instance with mod_wsgi
- nspo on NMPC with CasADi and Python – Part 1: ODE and steady state
Leave a Reply