Post Install Tweak

Increase file upload limit and PHP memory limit for Nextcloud.

This setting is done in the php.ini file located at /etc/php/8.2/fpm/

upload_max_filesize = 1G
memory_limit = 512M

Do not forget to restart php8.2-fpm and nginx after saving the configuration

Fix for the issue: PHP does not seem to be setup properly to query system environment variables.

We need to configure the file www.conf at /etc/php/8.2/fpm/pool.d by uncommenting the following lines.

;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
env[HOSTNAME] = $HOSTNAME
env[PATH] = /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Do not forget to restart php8.2-fpm and nginx after saving the configuration

Setup cronjob

A system like Nextcloud sometimes requires tasks to be done on a regular basis without the need for user interaction or hindering Nextcloud performance. For that purpose, as a system administrator, you can define background jobs (for example, database clean-ups) which are executed without any need for user interaction.

sudo crontab -u www-data -e  //creates new crontab if none exist
sudo -u www-data crontab -l  // shows the crontab content if it exists

For setting an interval of 15 min between each cron job, add the following line to crontab.

*/15  *  *  *  * php -f /var/www/nextcloud/cron.php

Setup Memory Caching (APCU)

You can significantly improve your Nextcloud server performance with memory caching, where frequently-requested objects are stored in memory for faster retrieval APCu is a data cache. APCu – very fast because it doesn’t write anything to the disk, simply stores it as is. It is recomended for Small/Private home servers. Install APCu for your php version - e.g. 8.3

sudo apt install php8.3-apcu

Configure the apcu.ini file in /etc/php/8.3/mods-available by adding below lines. This enables the apc cli and also increases the memory from default 32M to 128 M

extension=apcu.so
apc.shm_size = 128M
apc.enable_cli=1

Now configure the nextcloud conf.php file to start using APCu. Add below line to the end in file /var/www/nextcloud/config

'memcache.local' => '\OC\Memcache\APCu',

Last updated