Table des matières

PhpMyAdmin

Installation

Pour Debian et Ubuntu il existe un paquet dans les dépôts, cependant, au moment où j'écris cette page, il existe un bug dans l'installation. J'ai donc choisi d'installer la dernière version à partir des sources.

Vérifier les sources

Pour vérifier l'intégrité des fichiers (somme de contrôle et signature GPG), le détail est expliqué ici.

Création d'un sous domaine dans Bind

Il faut ensuite éditer sa zone DNS pour ajouter un sous-domaine, mais il est aussi possible d'installer PhpMyAdmin dans un répertoire. Je ne détaille pas ici la création de zone.

Création d'un serveur virtuel Apache2

Je crée un VirtualHost sur le port 80, j'ajouterai ensuite une redirection sur le port 443, mais il faut générer un certificat SSL, pour éviter les erreurs avec Let's Encrypt j'ai commenté la directive RewriteRule.

<VirtualHost *:80>
        ServerName phpmyadmin.d2air.com
        ServerAlias phpmyadmin.d2air.com
        ServerAdmin email@d2air.com
        DocumentRoot /var/www/phpmyadmin
        RewriteEngine On
        #RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Création d'un certificat avec Let's Encrypt

certbot certonly --webroot -w /var/www/phpmyadmin -d phpmyadmin.d2air.com --email email@d2air.com --rsa-key-size 4096

Ajout d'un VirtualHost *:443

La directive RewriteRule peut maintenant être décommentée, ensuite il faut créer un VirtualHost afin d'utiliser SSL. J'utilise ici une configuration restrictive, il faudra peut-être une configuration plus souple si de nombreux clients doivent se connecter.

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName phpmyadmin.d2air.com
        ServerAlias phpmyadmin.d2air.com
        ServerAdmin email@d2air.com
        DocumentRoot /var/www/phpmyadmin
        <Directory />
                Options SymLinksIfOwnerMatch
                AllowOverride None
                Require all denied
        </Directory>
        <Directory /var/www/phpmyadmin/>
                Options -Indexes -FollowSymLinks +MultiViews
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
        # enable HTTP/2, if available
        Protocols h2 http/1.1
        # SSL Engine Switch:
        # Enable/Disable SSL for this virtual host.
        SSLEngine on
        # The CRIME attack uses SSL Compression, we need to disable that
        SSLCompression off
        SSLProtocol +TLSv1.3 -TLSv1.2 -TLSv1.1 -TLSv1 -SSLv3 -SSLv2
        SSLCipherSuite TLSv1.3  TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
        SSLHonorCipherOrder on
        SSLSessionTickets off
        SSLUseStapling On
        # SSLStaplingCache must be exist in /etc/apache2/mods-available/ssl.conf
        # SSLOpenSSLConfCmd is supported by version 2.5 and later
        SSLOpenSSLConfCmd DHParameters  /etc/ssl/private/dh4096.pem
        SSLCertificateFile /etc/letsencrypt/live/phpmyadmin.d2air.com/cert.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/phpmyadmin.d2air.com/privkey.pem
        SSLCACertificateFile /etc/letsencrypt/live/phpmyadmin.d2air.com/fullchain.pem
</VirtualHost>
</IfModule>

Configuration

Pour configurer facilement PhpMyAdmin, ajouter setup/ à l'adresse de votre installation sur le serveur web.