Speed up and extend Nextcloud on Virtualmin: Configure Redis, APCu, PHP-FPM and HTTP/2 correctly for a fast member cloud
Learn how to significantly speed up your Nextcloud on Virtualmin with Redis, APCu, PHP-FPM and HTTP/2. Step-by-step guide for a high-performance member cloud.
Why performance optimization for Nextcloud on Virtualmin is important
Nextcloud is a powerful collaboration platform, but without the right configuration it can quickly become sluggish under load – especially when many members access it simultaneously. Virtualmin provides a solid foundation, but to get the most out of it, some optimizations are necessary. In this article, we show you how to significantly speed up your Nextcloud with Redis, APCu, PHP-FPM and HTTP/2.
The right foundation: Virtual server or web hosting?
Before you start with the optimizations, make sure your infrastructure is sufficiently sized. For a member cloud with multiple users, we recommend a virtual server or a powerful web hosting package. Ensure sufficient RAM (at least 2 GB, better 4 GB) and a fast SSD.
PHP-FPM: The key to better performance
Virtualmin often uses mod_php or CGI by default, which is inefficient. PHP-FPM (FastCGI Process Manager) enables significantly better management of PHP processes and reduces memory consumption.
How to enable PHP-FPM in Virtualmin
- Log in to Virtualmin and go to Server Configuration > PHP Options.
- Select PHP-FPM as the execution mode.
- Adjust the process management: For a member cloud, pm = dynamic and pm.max_children = 10-20 (depending on RAM) are recommended.
- Save the settings and restart the PHP-FPM service.
With PHP-FPM, requests are processed faster and server load drops noticeably.
APCu: Local cache for PHP operations
APCu is an in-memory cache for PHP variables. Nextcloud uses it to cache frequently needed data such as configurations or translations. Installation is easy:
- Install the APCu module:
apt install php-apcu(Debian/Ubuntu) oryum install php-pecl-apcu(CentOS/RHEL). - Enable it in the PHP configuration:
apc.enabled=1andapc.shm_size=128M(at least 128 MB). - Restart PHP-FPM.
In the Nextcloud configuration (config.php), add the following:
'memcache.local' => '\\OC\\Memcache\\APCu',
Redis: Distributed cache and file locking
Redis is a powerful in-memory data store that can be used as a distributed cache and for file locking. Especially with multiple web servers or high load, Redis is indispensable.
Install and configure Redis
- Install Redis:
apt install redis-server. - Ensure Redis is running and password-protected if necessary (in
/etc/redis/redis.conf). - Install the PHP extension:
apt install php-redis. - In Nextcloud's config.php, add:
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'redis' => [
'host' => 'localhost',
'port' => 6379,
'password' => 'yourPassword',
'timeout' => 0.0,
],
For file locking, also add:
'filelocking.enabled' => true,
'memcache.locking' => '\\OC\\Memcache\\Redis',
This prevents conflicts during simultaneous access and improves stability.
HTTP/2: Faster transmission thanks to multiplexing
HTTP/2 enables parallel transmission of multiple resources over a single TCP connection, significantly reducing load times. The prerequisite is HTTPS with a valid SSL certificate.
Enable HTTP/2 in Virtualmin
- Ensure your web server (Apache or Nginx) supports HTTP/2. For Apache, you need the
http2module (version 2.4.17 or later). - Enable the module:
a2enmod http2. - In the VirtualHost configuration, add
Protocols h2 http/1.1. - Restart Apache and verify activation with
curl -I https://your-domain.com(look forHTTP/2in the response).
With Nginx, HTTP/2 is often enabled by default once SSL is configured.
More tips for maximum performance
- Enable and optimize OPcache (in php.ini:
opcache.enable=1,opcache.memory_consumption=128). - Optimize the database: Use MySQL/MariaDB with InnoDB and adjust
innodb_buffer_pool_size(about 50-70% of RAM). - Switch Nextcloud cron to cron job (not AJAX) for better background tasks.
- Consider a CDN for static resources if many external users access.
Conclusion: A fast member cloud is not rocket science
With the right settings, you get the most out of your Nextcloud on Virtualmin. PHP-FPM, APCu, Redis and HTTP/2 are the most important levers for a high-performance and scalable member cloud. If you don't yet have the right infrastructure, take a look at our virtual servers or web hosting packages – optimal for Nextcloud. If you have questions, our support is happy to help.
