Activer le HTTPS sur votre site WordPress

Installer un certificat SSL

Pour activer le HTTPS sur votre site WordPress, vous devez installer un certificat SSL gratuit. Les commandes suivantes vont vous permettre de récupérer ce certificat de Let’s Encrypt.

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo apt-get install certbot python3-certbot-apache
$ sudo certbot --apache

Si vous à la dernière étape vous rencontrez une erreur de type « The key authorization file from the server did not match this challenge« , il est possible que ce soit parce que votre serveur n’est pas joignable lorsque votre nom de domaine est appelé. Je vous invite à consulter l’article Gestion du Dyndns sous linux debian avec un nom de domaine ovh qui décrit le cas de figure hébergement local derrière une box + nom de domaine OVH.

Si tout se déroule comme prévu, voici un exemple de ce que vous devriez avoir à l’écran.

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: monNomDeDomaine.com
2: www.monNomDeDomaine.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 2
Obtaining a new certificate
Created an SSL vhost at /etc/apache2/sites-available/monNomDeDomaine.com-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/monNomDeDomaine.com-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/monNomDeDomaine.com-le-ssl.conf

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/monNomDeDomaine.com.conf to ssl vhost in /etc/apache2/sites-available/monNomDeDomaine.com-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://www.monNomDeDomaine.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=www.monNomDeDomaine.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/www.monNomDeDomaine.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/www.monNomDeDomaine.com/privkey.pem
   Your cert will expire on 2021-02-15. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Remarque : si vous avez mis en place la redirection domain root vers le sous-domaine www décrite dans Gestion du Dyndns sous linux debian avec un nom de domaine ovh , vous ne pourrez activer le https que sur le sous-domaine en www.

Modifier le paramétrage WordPress de http à https

Connectez-vous au dashboard, puis sélectionnez General dans le menu Settings à gauche.

Modifier les deux URLs afin qu’elles soient toutes deux en « https:// » puis sauvegarder les modifications.

Partager sur :
Étiquettes: