Passer au contenu principal

Configuration Nextcloud

Machine VM

  • Ubuntu 21.04
  • 2vCPU
  • 2Go de RAM
  • 300 Go de disque
Activer les dépôt PHP 8.0
apt install ca-certificates apt-transport-https software-properties-common
add-apt-repository ppa:ondrej/php
Supprimer Snapd
apt remove --purge snapd

Installation des pré-requis

apt install apache2 mariadb-server php-fpm
apt install php-fpm php-common php-mbstring php-xmlrpc php-soap php-gd php-mysql php-xml php-intl php-mysql php-cli php-ldap php-zip php-curl php-apcu php-cas php-bz2 php-imap php-tidy php-bcmath php-gmp
apt-get install libmagickcore-6.q16-6-extra

Configuration MariaDB

CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'nextcloud';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Activation modules PHP-FPM

# Activation des modules PHP-CGI
a2enmod proxy_fcgi
a2enconf php8.0-fpm.conf

# Activation des modules HTTPS
a2enmod ssl
a2enmod rewrite
a2enmod headers
a2enmod socache_shmcb

# Relancer le service apache
systemctl restart apache2

Configuration Apache

<VirtualHost *:80>
# Racine Web
DocumentRoot /var/www/nextcloud

# Bloc configuration Application
   <Directory /var/www/nextcloud>
        Options ExecCGI FollowSymlinks MultiViews
        AllowOverride All
        Require all granted
        <IfModule mod_dav.c>
        Dav off
        </IfModule>
   </Directory>

# Emplacements des logs
  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Une fois les fichier installé et le serveur configuré aller sur la page web du serveur puis lancer la procédure d'installation :

  • Indiquez le compte admin a créer
  • Indiquez le nom et mot de passe du compte de base de donnée à utiliser par nextcloud
  • Indiquez le nom de la base de donnée à utiliser
  • ???
  • Profitez bien du cloud !

Configuration Nextcloud

Fichier de configuration

Il est ou le fichier de config ?
/var/www/nextcloud/config/config.php

<?php
$CONFIG = array (
  'instanceid' => 'id_instance',
  'passwordsalt' => 'mot_de_passe_salé',
  'secret' => 'Secret',
  'trusted_domains' =>
  array (
    0 => 'cloud.lgarre.fr',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.0.0.11',
  'overwrite.cli.url' => 'https://cloud.lgarre.fr',
  'overwriteprotocol' => 'https',
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => 'FR',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'nextcloud',
  'installed' => true,
  'updater.secret' => 'secret_updater',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.release.channel' => 'beta',
);
Taches planifié

Ajouter une tâche planifiée au compte du serveur web (www-data)

crontab -u www-data -e

L'éditeur de votre choix s'ouvre, ajouter la ligne suivante

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

Dans les paramètre de NextCloud sélectionnez Cron en tant que gestionnaire des tâches de fond

image-1626250732545.png