Introduction
Nextcloud is a popular open-source file hosting and collaboration platform that provides secure file sharing, versioning, and access control features. When hosting Nextcloud on a Debian 12 bare metal server with a MariaDB database, you may encounter issues when trying to upload large files. This article aims to provide a solution for this issue.
Problem: Uploading Large Files on Nextcloud
When attempting to upload large files (e.g., 100 MB) to Nextcloud on a Debian 12 bare metal server with a MariaDB database, you may encounter an "estimated upload time" that keeps increasing in the browser, effectively preventing the upload from completing.
Cause: PHP Configuration
The issue is typically caused by the PHP configuration on the server. In particular, the post_max_size and upload_max_filesize settings in the PHP configuration may be set too low, preventing large file uploads.
Solution: Increasing PHP Configuration Limits
To increase the PHP configuration limits, you can follow these steps:
- Locate the
php.inifile on your server. On Debian 12, this file is typically located at/etc/php/8.1/fpm/php.ini(replace "8.1" with your PHP version if different). - Open the
php.inifile in your preferred text editor. - Find the
post_max_sizeandupload_max_filesizesettings, and increase their values. For example, to increase the limits to 256 MB, you can set them as follows:
post\_max\_size = 256M
upload\_max\_filesize = 256M
Note that these settings are specified in bytes. Thus, 256 MB is equivalent to 256 * 1024 * 1024 bytes.
- Save the
php.inifile, and then restart the PHP-FPM service for the changes to take effect:
sudo systemctl restart php8.1-fpmVerifying the Changes
To verify that the changes have taken effect, you can use the following PHP code:
<?php
phpinfo();
?>
Save this code in a file with the .php extension (e.g., info.php) and place it in your Nextcloud web root directory. Access the info.php file through your web browser. Search for the post_max_size and upload_max_filesize settings in the output to verify that their values have been increased.
Large file uploads in Nextcloud on a Debian 12 bare metal server with a MariaDB database can be a challenging issue to solve. However, by increasing the PHP configuration limits, you can allow larger files to be uploaded seamlessly. Make sure to maintain appropriate security measures when allowing large file uploads, as this can introduce potential security risks if proper precautions are not taken.
References
- books: Nextcloud Essentials: Managing and Collaborating on the Secure File Hosting Platform
- articles: How to Install Nextcloud on Debian 11
- online resources: Nextcloud PHP Configuration