Nextcloud Installation & Optimization Guide#


1. PHP Configuration#

Ensure PHP 8.3 is tuned for Nextcloud performance.

Edit php.ini#

nano /etc/php/8.3/apache2/php.ini

Modify these values (remove the ; prefix):

memory_limit = 512M
upload_max_filesize = 200M
max_execution_time = 360
post_max_size = 200M
date.timezone = America/Toronto

; OPcache Settings
opcache.enable=1
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Enable Apache Modules & APCu#

a2enmod dir env headers mime rewrite ssl
systemctl restart apache2
# Enable CLI for memory caching
nano /etc/php/8.3/mods-available/apcu.ini

Add:

extension=apcu.so
apc.enable_cli=1
systemctl restart apache2

2. Nextcloud Config (config.php)#

Configure trusted domains, SSL protocols, and caching.

Edit Configuration#

nano /var/www/nextcloud/config/config.php

Template Content:

<?php
$CONFIG = array (
  'overwriteprotocol' => 'https',
  'trusted_domains' => 
  array (
    0 => '10.1.2.204',
    1 => 'nc.marcoue.com',
    2 => 'nextcloud.marcoue.com',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'dbhost' => 'localhost',
  'dbname' => 'nextcloud',
  'dbuser' => 'nextcloud',
  'dbpassword' => 's7!2HpC744PNU3.VzFMx',
  'installed' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'default_phone_region' => 'US',
  'mail_smtpmode' => 'smtp',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'marc.ouellet@gmail.com',
  'mail_smtppassword' => '1password',
  'twofactor_enforced' => 'true', 
  'maintenance' => false,
);

3. Security & Error Resolution#

File Permissions#

# Secure the config file
chown root:www-data /var/www/nextcloud/config/config.php
chmod 660 /var/

4. Nextcloud AIO Update Procedure#

For All-in-One (AIO) installations managed via Docker.

Step 1: Update the AIO Manager#

Pull the latest image for the AIO dashboard container.

cd /home/marc/docker-compose/nextcloud-aio
docker compose pull
docker compose up -d

Step 2: Update Nextcloud Containers#

The Docker pull only updates the management interface. You must trigger the actual Nextcloud version jump (e.g., v32 to v33) through the web UI.

  1. Navigate to the AIO Interface at https://your-domain:8080 (or https://10.1.2.204:8080).
  2. Log in with your AIO password.
  3. Click Stop Containers (Required before updating).
  4. Once stopped, click Check for Updates.
  5. If a new version is found, click Update Containers.
  6. Wait for the process to finish and click Start Containers.

Step 3: Verify the Version#

Check the Overview page in your Nextcloud admin settings.

  • Nextcloud Hub 25 Autumn corresponds to internal version v32.
  • Nextcloud Hub 26 Winter corresponds to internal version v33.