Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
drupal10:deploiement_sur_serveur [2023/08/10 07:59] marclebrun [Création du projet] |
drupal10:deploiement_sur_serveur [2023/12/02 03:51] (Version actuelle) marclebrun [Trusted Host] |
||
---|---|---|---|
Ligne 23: | Ligne 23: | ||
<code bash> | <code bash> | ||
sudo apt install zip unzip | sudo apt install zip unzip | ||
- | sudo apt install php-mbstring php-xml php-gd php-curl php-zip | + | sudo apt install php-mbstring php-xml php-gd php-curl php-zip php-mysql |
</code> | </code> | ||
Ligne 37: | Ligne 37: | ||
sudo a2enmod rewrite | sudo a2enmod rewrite | ||
sudo systemctl restart apache2 | sudo systemctl restart apache2 | ||
+ | </code> | ||
+ | |||
+ | ===== Activer les extensions PHP ===== | ||
+ | |||
+ | <code bash> | ||
+ | sudo vi /etc/php/8.1/apache2/php.ini | ||
+ | </code> | ||
+ | |||
+ | Décommenter les lignes suivantes : | ||
+ | |||
+ | <code ini> | ||
+ | extension=gd | ||
+ | extension=mbstring | ||
+ | extension=pdo_mysql | ||
+ | </code> | ||
+ | |||
+ | <code bash> | ||
+ | sudo systemctl reload apache2.service | ||
</code> | </code> | ||
Ligne 115: | Ligne 133: | ||
</Directory> | </Directory> | ||
- | ErrorLog ${APACHE_LOG_DIR}/drupal10.localhost/error.log | + | ErrorLog ${APACHE_LOG_DIR}/drupal10/error.log |
- | CustomLog ${APACHE_LOG_DIR}/drupal10.localhost/access.log combined | + | CustomLog ${APACHE_LOG_DIR}/drupal10/access.log combined |
</VirtualHost> | </VirtualHost> | ||
+ | </code> | ||
+ | |||
+ | Créer le dossier pour les fichiers **.log** | ||
+ | |||
+ | <code bash> | ||
+ | sudo mkdir /var/log/apache2/drupal10 | ||
+ | sudo chown root:adm /var/log/apache2/drupal10 | ||
</code> | </code> | ||
Ligne 123: | Ligne 148: | ||
<code bash> | <code bash> | ||
- | sudo a2ensite drupal10.localhost.conf | + | sudo a2ensite drupal.marclebrun.be.conf |
sudo apachectl configtest | sudo apachectl configtest | ||
sudo systemctl reload apache2 | sudo systemctl reload apache2 | ||
</code> | </code> | ||
- | Accéder à l'adresse [[http://drupal.marclebrun.be]] pour suivre les étapes d'installation. | + | Ajouter un certificat **let's encrypt** pour le nouveau site : |
+ | |||
+ | <code bash> | ||
+ | sudo certbot certonly --apache | ||
+ | </code> | ||
+ | |||
+ | Si besoin voir [[apache:activer_https_avec_lets_encrypt_ubuntu2204]] | ||
+ | |||
+ | Modifier le fichier de configuration d'Apache : | ||
+ | |||
+ | <code apache drupal.marclebrun.be.conf> | ||
+ | <VirtualHost *:80> | ||
+ | ServerName drupal.marclebrun.be | ||
+ | ServerAdmin marc@domaine.com | ||
+ | |||
+ | RewriteEngine on | ||
+ | RewriteCond %{HTTPS} !on | ||
+ | RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} | ||
+ | </VirtualHost> | ||
+ | |||
+ | <VirtualHost *:443> | ||
+ | ServerName drupal.marclebrun.be | ||
+ | ServerAdmin marc@domaine.com | ||
+ | |||
+ | DocumentRoot /var/www/drupal10/web | ||
+ | <Directory /var/www/drupal10/web> | ||
+ | Options Indexes FollowSymLinks MultiViews | ||
+ | AllowOverride all | ||
+ | Require all denied | ||
+ | Require all granted | ||
+ | allow from all | ||
+ | </Directory> | ||
+ | |||
+ | SSLEngine on | ||
+ | SSLCertificateFile /etc/letsencrypt/live/drupal.marclebrun.be/cert.pem | ||
+ | SSLCertificateKeyFile /etc/letsencrypt/live/drupal.marclebrun.be/privkey.pem | ||
+ | SSLCertificateChainFile /etc/letsencrypt/live/drupal.marclebrun.be/chain.pem | ||
+ | SSLProtocol all -SSLv2 -SSLv3 | ||
+ | SSLHonorCipherOrder on | ||
+ | SSLCompression off | ||
+ | SSLOptions +StrictRequire | ||
+ | SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA | ||
+ | Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains" | ||
+ | |||
+ | ErrorLog ${APACHE_LOG_DIR}/drupal10/error.log | ||
+ | CustomLog ${APACHE_LOG_DIR}/drupal10/access.log combined | ||
+ | </VirtualHost> | ||
+ | </code> | ||
+ | |||
+ | Re-tester et recharger la config d'Apache : | ||
+ | |||
+ | <code bash> | ||
+ | sudo apachectl configtest | ||
+ | sudo systemctl reload apache2 | ||
+ | </code> | ||
+ | |||
+ | Accéder à l'adresse [[https://drupal.marclebrun.be]] pour suivre les étapes d'installation de **Drupal**. | ||
+ | |||
+ | ===== Trusted Host ===== | ||
+ | |||
+ | Éditer le fichier ''/sites/default/settings.php'' et spécifier toutes les variante | ||
+ | du(des) nom(s) de domaine auxquelles le site est autorisé à répondre : | ||
+ | |||
+ | <code bash> | ||
+ | sudo chmod a+w sites/default/settings.php | ||
+ | sudo vi sites/default/settings.php | ||
+ | sudo chmod a-w sites/default/settings.php | ||
+ | </code> | ||
+ | |||
+ | <code php> | ||
+ | $settings['trusted_host_patterns'] = [ | ||
+ | '^marclebrun\.be$', | ||
+ | '^.+\.marclebrun\.be$', | ||
+ | '^marclebrun\.com$', | ||
+ | '^.+\.marclebrun\.com$', | ||
+ | ]; | ||
+ | </code> | ||