Certificat SSL sur IIS
IIS (Internet Information Services) gère les sites web sur Windows Server. Pour servir du HTTPS, vous devez obtenir un certificat TLS, l'importer dans le magasin Windows et créer une liaison (binding) sur le port 443.
Prérequis
- VPS Windows avec IIS installé et site fonctionnel en HTTP
- Nom de domaine pointant vers l'IP publique du VPS (enregistrement A)
- Port 443/TCP ouvert (pare-feu Windows + HolyCloud si applicable)
- Droits administrateur
Vérifier IIS et le site
Get-Service W3SVC
Get-Website
Get-WebBinding -Name 'Default Web Site'
Installez le rôle IIS si nécessaire :
Install-WindowsFeature Web-Server -IncludeManagementTools
Option A : certificat Let's Encrypt (win-acme)
win-acme (WACS) automatise Let's Encrypt sur IIS.
- Téléchargez la dernière version win-acme depuis le dépôt officiel.
- Extrayez dans
C:\Tools\win-acme\. - Lancez
wacs.exeen administrateur.
Exemple en ligne de commande (mode non interactif simplifié — adaptez l'ID de site) :
cd C:\Tools\win-acme
.\wacs.exe --target iis --siteid 1 --installation iis --accepttos --emailaddress [email protected]
Le certificat est importé dans Local Computer → Personal et la liaison HTTPS est créée.
Tâche planifiée : win-acme installe généralement une tâche de renouvellement automatique.
Option B : certificat commercial ou PFX manuel
Si vous avez un fichier .pfx fourni par une CA :
$Password = ConvertTo-SecureString -String 'MotDePasseExportPfx' -Force -AsPlainText
Import-PfxCertificate -FilePath 'C:\Certs\votredomaine.pfx' `
-CertStoreLocation Cert:\LocalMachine\My -Password $Password
Listez le certificat (notez le Thumbprint) :
Get-ChildItem Cert:\LocalMachine\My | Where-Object { $_.Subject -like '*votredomaine*' } |
Format-List Subject, Thumbprint, NotAfter
Créer la liaison HTTPS dans IIS
GUI : IIS Manager → Sites → votre site → Bindings → Add :
- Type : https
- Port : 443
- Host name :
www.votredomaine.fr - SSL certificate : sélectionnez le certificat importé
PowerShell :
$Thumb = 'A1B2C3D4E5F6...' # remplacer par le thumbprint réel
New-WebBinding -Name 'Default Web Site' -Protocol https -Port 443 `
-HostHeader 'www.votredomaine.fr' -SslFlags 1
$Binding = Get-WebBinding -Name 'Default Web Site' -Protocol https -Port 443
$Binding.AddSslCertificate($Thumb, 'my')
Redirection HTTP → HTTPS
Installez le module URL Rewrite pour IIS, puis ajoutez une règle de redirection dans web.config à la racine du site :
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Ou via PowerShell (si URL Rewrite installé) — préférez l'édition GUI pour la première fois.
Protocoles TLS modernes
Désactivez SSL 2.0/3.0 et TLS 1.0/1.1 (IISCrypto ou registre). Exemple PowerShell (TLS 1.2 client/serveur) :
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' -Name Enabled -Value 1
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' -Name DisabledByDefault -Value 0
Redémarrez IIS :
iisreset
Test et diagnostic
Invoke-WebRequest -Uri 'https://www.votredomaine.fr' -UseBasicParsing | Select-Object StatusCode
Depuis l'extérieur :
curl -vI https://www.votredomaine.fr
openssl s_client -connect www.votredomaine.fr:443 -servername www.votredomaine.fr </dev/null 2>/dev/null | openssl x509 -noout -dates
Renouvellement
| -------- | -------- |
|---|---|
| Let's Encrypt / win-acme | Vérifier la tâche planifiée ; lancer wacs.exe --renew |
| PFX commercial | Importer le nouveau PFX avant NotAfter ; mettre à jour le binding |
Dépannage
| Problème | Solution | |
|---|---|---|
| ---------- | ---------- | |
| 443 inaccessible | Pare-feu ; `netstat -an | findstr 443` |
| Chaîne incomplète | Importer les certificats intermédiaires CA | |
| Boucle de redirection | Une seule règle HTTPS (IIS + app) |
Voir aussi : documentation Installer IIS sur le même VPS.
Besoin d'aide ?
Ticket HolyCloud avec le domaine, le type de certificat (Let's Encrypt / commercial) et la sortie de Get-Website / Get-WebBinding.