Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views : Ad Clicks :Ad Views :

Tuning Nextcloud for better Performance


In this article, we will learn Tuning Nextcloud Server performance by the use of Memory cache and required software optimization. For getting better performance, these settings should be implemented in every Nextcloud installation.

Nextcloud can be used on a machine with a single-core CPU and 1 GB of ram but it depends on how many users are there. In this article, we will learn about Tuning Nextcloud for better performance with the use of caching. For this, we will use the Redis Server and PHP OPcache.

By using the below optimization, you can notice improvements mainly in the Web Interface of the Nextcloud. Tuning Nextcloud using cache will help you get better performance of Web Interface and decrease the load on the server which is caused by the Web Server Processes.

Tuning Nextcloud Performance

At the very first stage, you need a running instance of the Nextcloud Server. If you do not have yet, you can follow these articles to get one:

Upgrade Apache and PHP to the latest versions

Nextcloud team suggests Apache for better compatibility. Nextcloud is the successor of the Owncloud and Owncloud mainly developed for the Apache Web Server. But now Nextcloud also documented Nginx Web Server Configuration with PHP-FPM. So now, we can easily configure Nextcloud with Nginx Server.

PHP 7.2 or PHP 7.3 is recommended for Nextcloud 17 Version. Where PHP 5 was supported in earlier versions. The latest version of PHP is 7.4 and Nextcloud 17 will run on it. You can install PHP 7.4 with Nextcloud 17 by following this tutorial.

Enable PHP OPcache

PHP OPcache is one of the memory cache supported by Nextcloud. It improves the performance of PHP applications by caching precompiled bytecode. For better performance, every Nextcloud server should have this enabled.

You can enable it by adding the below lines in your 10-opcache.ini file which is located under your /etc/php directory. (For example, if you have PHP 7.4 installed then you will find the file in /etc/php/7.4/conf.d/10-opcache.ini)



You may experience slow loading of the web interface in Nextcloud Server if you are using PHP-FPM. However, For overcoming this issue more processes should be allowed to run even on a small installation. The below configuration is provided for an instance with 4GB of RAM and 1GB of MySQL cache. Add the below code in your www.conf file which is located in /etc/php/ directory.

pm = dynamic
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18

Enable Redis for memory Cache

Nextcloud allows both Local or File locking cache. Redis an in-memory key-value database that can be used to improve the performance of PHP applications like Nextcloud.

Here we are using Redis for both local caching and file locking. Firstly, we have to install the Redis server by using the below command.

apt-get install redis-server php-redis -y

After installing, start and enable the Redist server by using the below command.

sudo systemctl start redis-server
sudo systemctl enable redis-server

After that, add the below lines at the bottom in your config.php file which is located in /var/www/html/nextcloud/config/config.php

'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,

Save the file and restart the Web Server by using the below command.

For Apache Web Server

sudo systemctl restart apache2

For PHP-FPM with PHP 7.4

systemctl restart php7.4-fpm

As a result, now you have successfully configured the Redis server cache for the Nextcloud server. In conclusion, for better performance of the Nextcloud server, these simple tweaks are recommended for every instance.


In this article, we learned how to Tune and Optimize the Nextcloud server with the help of Memory Cache and some software upgrades. However, You can share your views in the comment section.


Leave a Comment

Your email address will not be published.

This div height required for enabling the sticky sidebar