Comment installer un serveur Nexcloud 29 sous Debian 12 Bookworm

06 Jul 2024 à 10:30 par larevuegeek - 1221 vues - 0 com.
Logiciels OS Linux
Voici les commandes pour vous aider à installer un serveur Nextcloud sous Debian 12.

-------------- Installation du serveur Web

su -
sudo apt update && apt-get upgrade

#Installation de Apache 2 et PHP8.2

apt-get -y install apache2 curl apache2-doc apache2-utils libapache2-mod-php8.2 php8.2 php8.2-common php8.2-gd php8.2-mysql php8.2-imap php8.2-cli libapache2-mod-fcgid apache2-suexec-pristine php-pear mcrypt imagemagick libruby libapache2-mod-python php8.2-curl php8.2-intl php8.2-pspell php8.2-sqlite3 php8.2-tidy php8.2-xmlrpc php8.2-xsl php-imagick php8.2-zip php8.2-mbstring php8.2-soap php8.2-fpm php8.2-opcache php8.2-apcu
a2enmod suexec rewrite ssl include dav_fs dav auth_digest expires headers fastcgi actions proxy_fcgi
a2enconf php8.2-fpm

-------------- Structure du projet
 

groupadd web001
useradd -M -g web001 -s /usr/sbin/nologin web001

mkdir -p /var/www/nextcloud/web
mkdir -p /var/www/nextcloud/log
mkdir -p /var/www/nextcloud/tmp

chown -R web001:web001 /var/www/nextcloud/web
chown -R web001:web001 /var/www/nextcloud/tmp


-------------------------
------------------ Configuration de PHP FPM

nano /etc/php/8.2/fpm/pool.d/larevuegeek.nextcloud.localhost.conf

[larevuegeek.nextcloud.localhost]

listen = /run/php/larevuegeek.nextcloud.localhost.sock
listen.owner = web0
listen.group = www-data
listen.mode = 0660

user = web001
group = web001

pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 0

chdir = /

php_admin_value[open_basedir] = /var/www/nextcloud/web:/var/www/nextcloud/tmp:/usr/share/php:/tmp:/dev/urandom:/
php_admin_value[session.save_path] = /var/www/nextcloud/tmp
php_admin_value[upload_tmp_dir] = /var/www/nextcloud/tmp
php_admin_value[sendmail_path] = "/usr/sbin/sendmail -t -i -flarevuegeek.nextcloud.localhost"


-------------------------

--------------------- Création du Vhost

nano /etc/apache2/sites-available/larevuegeek.nextcloud.localhost.conf

<Directory /var/www/nextcloud>
        AllowOverride None
        Require all denied
</Directory>

<VirtualHost *:80>
                DocumentRoot /var/www/nextcloud/web

                ServerName larevuegeek.nextcloud.localhost
                ServerAdmin webmaster@larevuegeek.nextcloud.localhost
                
                CustomLog /var/www/nextcloud/log/access.log combined
                ErrorLog /var/www/nextcloud/log/error.log

                SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

                <Directory /var/www/nextcloud/web>                   
                    Options +FollowSymLinks -Indexes
                    AllowOverride All
                    Require all granted
                </Directory>

                <Directory /var/www/nextcloud/web>
                    <FilesMatch ".+\.ph(p[3457]?|t|tml)$">
                        SetHandler "proxy:unix:/run/php/larevuegeek.nextcloud.localhost.sock|fcgi://localhost"
                    </FilesMatch>
                </Directory>

                <IfModule mod_dav_fs.c>
                    # Do not execute PHP files in webdav directory
                    <Directory /var/www/nextcloud/webdav>
                        <FilesMatch "\.ph(p3?|tml)$">
                            SetHandler None
                        </FilesMatch>
                    </Directory>
                    DavLockDB /var/www/nextcloud/tmp/DavLock
                </IfModule>

            <IfModule mod_headers.c>
                Header always set X-Content-Type-Options "nosniff"
                Header always set X-Frame-Options "DENY"
                Header always set X-XSS-Protection "1; mode=block"
                Header always set Referrer-Policy "no-referrer"
            </IfModule>
            
            Protocols h2 h2c http/1.1
</VirtualHost>


a2ensite larevuegeek.nextcloud.localhost

-------------------------
------------------------- OPTIMISATION APACHE & PHP

nano /etc/apache2/conf-enabled/security.conf
ServerTokens Prod
ServerSignature Off

nano /etc/php/8.2/fpm/conf.d/10-opcache.ini
opcache.jit=off

opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=512
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=60229
opcache.max_wasted_percentage=10
opcache.revalidate_freq=10
opcache.fast_shutdown=1
opcache.enable_file_override=0
opcache.max_file_size=0
opcache.jit = 1255
opcache.jit_buffer_size = 128M

#HTTP/2
a2dismod php8.2
a2dismod mpm_prefork
a2enmod mpm_event
systemctl restart apache2
a2enmod http2
systemctl restart apache2

-------------------------
------------------------- Base de données

sudo apt install mariadb-server mariadb-client
sudo systemctl start mariadb
sudo systemctl enable mariadb

mysql_secure_installation

mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'motdepasse';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

-------------------------
------------------------- Installation Nextcloud

wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip

-------------------------

 

A voir également

Commentaires

Soyez le 1er à commenter !

Ecrire un commentaire

Doit contenir 4 caractères minimum et seulement des caractères alphanumériques - et _
Veuillez préciser une adresse email valide.

Derniers bons plans

Google Pixel 9 Pro – Porcelaine, 128GB
20 Nov 2024, 08:09
1099.00 € 999.00 €
Bose SoundLink Micro : Petite Enceinte Portable étanche...
18 Nov 2024, 08:25
119.95 € 89.95 €
Casque Bluetooth Marshall Major IV - pliables, autonomie...
18 Nov 2024, 08:21
87.00 € 79.99 €

Dernières actualités