Host a website with IIS and Let's Encrypt
Install IIS on Windows Server, publish a website and enable HTTPS with a free Let's Encrypt certificate, renewed automatically with simple-acme.
On this page
Your values
Enter them once and the commands in this guide update.
This guide takes you from installing IIS (Internet Information Services) to an HTTPS website whose certificate renews itself. The certificates are issued by Let's Encrypt and managed by simple-acme, an ACME client for Windows.
Prerequisites
- A server running Windows Server 2019, 2022 or 2025, with an administrator account
- A domain name whose records point to the server. The Point to an IP guide explains how to create the A record
- Port TCP 80 reachable from the Internet: Let's Encrypt sends its HTTP validation there
- Port TCP 443 reachable to serve the website over HTTPS
Run the commands in Windows PowerShell as administrator. In the examples, replace your-domain.com with your domain.
Step 1: Install IIS
Using the graphical interface:
- Open Server Manager.
- Choose Manage, then Add Roles and Features.
- Select a role-based installation, then your server.
- Check Web Server (IIS), accept the management tools, then finish the wizard.
Using PowerShell:
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
Get-Service W3SVCThe W3SVC service should be in the Running state.
Step 2: Open the web ports
Add an explicit rule for HTTP and HTTPS:
New-NetFirewallRule -DisplayName 'Web-HTTP-HTTPS-In' -Direction Inbound -Protocol TCP -LocalPort 80,443 -Action AllowThis rule adds an authorization and does not change your RDP access. To use the graphical interface instead, follow the Firewall configuration guide with ports 80, 443.
Step 3: Create the website
Create the folder, a test page, the application pool and the website:
Import-Module WebAdministration
$site = 'my-site'
$root = "C:\inetpub\$site"
New-Item -ItemType Directory -Force -Path $root | Out-Null
Set-Content -Path "$root\index.html" -Value '<!doctype html><title>IIS</title><h1>IIS OK</h1>' -Encoding UTF8
New-WebAppPool -Name $site
New-Website -Name $site -PhysicalPath $root -ApplicationPool $site -Port 80 -HostHeader 'your-domain.com'
New-WebBinding -Name $site -Protocol http -Port 80 -HostHeader 'www.your-domain.com'
# Read access for the application pool identity
icacls $root /grant "IIS AppPool\${site}:(OI)(CI)RX"To get the same result in Internet Information Services (IIS) Manager (inetmgr):
- Right-click Sites, then choose Add Website.
- Enter the name, the physical path and the host name
your-domain.com, on port 80. - Select the website, open Bindings and add
www.your-domain.com.
If your application needs to write to a folder, for example for uploaded files, give it modify rights on that folder only.
Check the website over HTTP
Before requesting a certificate, open http://your-domain.com from your computer. The IIS OK page should appear. You can also run this test from a Windows computer:
Test-NetConnection your-domain.com -Port 80
Invoke-WebRequest -UseBasicParsing http://your-domain.com | Select-Object StatusCodeStep 4: Install simple-acme
Download the win-x64.trimmed build from simple-acme.com or the project's releases page, then extract it to a permanent folder. This folder must stay in place, because the scheduled renewal task uses it.
$version = '2.4.1.2444'
$tag = 'v2.4.1'
$zip = "$env:TEMP\simple-acme.zip"
Invoke-WebRequest -UseBasicParsing -OutFile $zip -Uri "https://github.com/simple-acme/simple-acme/releases/download/$tag/simple-acme.v$version.win-x64.trimmed.zip"
Expand-Archive -Path $zip -DestinationPath 'C:\Program Files\simple-acme' -Force
Remove-Item $zipThese numbers correspond to version 2.4.1. Check the releases page for a newer version, and adjust $version and $tag accordingly.
Step 5: Get the certificate
Using the menu
- Start the program:
cd 'C:\Program Files\simple-acme'
.\wacs.exe- Choose N to create a certificate with the default settings.
- Select your website, then the
your-domain.comandwww.your-domain.combindings. - Accept the terms of service and enter an email address if you wish.
The program validates the domain, places the certificate in the Windows store, creates the HTTPS bindings and sets up renewal.
With a single command
cd 'C:\Program Files\simple-acme'
$id = (Get-Website -Name 'my-site').id
.\wacs.exe --source iis --siteid $id --host 'your-domain.com,www.your-domain.com' --installation iis --accepttos --emailaddress 'contact@your-domain.com'Then open https://your-domain.com. The browser should show a secure connection, with no warning.
Step 6: Redirect HTTP to HTTPS
IIS 10 version 1709 and later, so Windows Server 2019 and newer, natively support redirection and HSTS, with no additional module:
Import-Module IISAdministration
Reset-IISServerManager -Confirm:$false
Start-IISCommitDelay
$sites = Get-IISConfigSection -SectionPath 'system.applicationHost/sites' | Get-IISConfigCollection
$siteElement = Get-IISConfigCollectionElement -ConfigCollection $sites -ConfigAttribute @{ name = 'my-site' }
$hsts = Get-IISConfigElement -ConfigElement $siteElement -ChildElementName 'hsts'
Set-IISConfigAttributeValue -ConfigElement $hsts -AttributeName 'enabled' -AttributeValue $true
Set-IISConfigAttributeValue -ConfigElement $hsts -AttributeName 'max-age' -AttributeValue 86400
Set-IISConfigAttributeValue -ConfigElement $hsts -AttributeName 'redirectHttpToHttps' -AttributeValue $true
Stop-IISCommitDelayKeep port 80 open: it is used for the redirection and for Let's Encrypt renewals.
Step 7: Check automatic renewal
simple-acme creates a daily scheduled task that runs under the SYSTEM account. It only renews certificates that are due and takes into account the renewal information provided by Let's Encrypt (ARI).
Get-ScheduledTask -TaskName 'simple-acme*' | Select-Object TaskName, State
Get-ScheduledTask -TaskName 'simple-acme*' | Get-ScheduledTaskInfo | Select-Object LastRunTime, LastTaskResult, NextRunTime
cd 'C:\Program Files\simple-acme'
.\wacs.exe --listTo test the whole chain once, force a renewal:
.\wacs.exe --renew --force --verboseDo not count on an email alert: Let's Encrypt stopped sending its expiration reminders on June 4, 2025. Instead, monitor the expiration date with your monitoring tool, or check the logs:
Get-ChildItem "$env:ProgramData\simple-acme\*\Log" | Sort-Object LastWriteTime -Descending | Select-Object -First 3 FullName, LastWriteTimeAutomation is becoming essential: Let's Encrypt plans to reduce the default lifetime of its certificates from 90 to 64 days on February 10, 2027, then to 45 days on February 16, 2028.
Check the result
https://your-domain.comandhttps://www.your-domain.comopen with no warning.http://your-domain.comredirects to HTTPS.- The
simple-acmetask exists andLastTaskResultis0after its first run. - The certificate presented is the right one:
Get-WebBinding -Name 'my-site' | Select-Object protocol, bindingInformation, sslFlags
Get-ChildItem Cert:\LocalMachine\WebHosting | Select-Object Subject, NotAfter, ThumbprintTroubleshooting
Validation fails (Authorization failed, Timeout, Connection refused)
- Check that the A record, and the AAAA record if there is one, points to this server:
Resolve-DnsName your-domain.com. - Test port 80 from outside and check the
Web-HTTP-HTTPS-Inrule. - Validation uses a listener shared with IIS. It cannot be allowed by a firewall rule limited to
wacs.exe, because the traffic goes throughSystem: open the port itself. - If the HTTPS redirection was just enabled, disable it temporarily to rule out this cause, then run the request again.
Wait a few minutes between attempts to avoid reaching the failure limit.
too many certificates or rateLimited
You have reached a Let's Encrypt limit. Wait until the date given in the message. Reinstalling the client or deleting its configuration makes no difference, because the limits are tied to the domain names and the account.
Port 80 is already in use
Identify the process:
Get-NetTCPConnection -LocalPort 80 -State Listen | ForEach-Object { Get-Process -Id $_.OwningProcess }
netsh http show servicestateThe System process is normal with IIS. Any other web server, such as Apache or nginx, must be stopped or moved.
The browser reports an incorrect certificate name
The requested name is not in the certificate, often because www was forgotten. Add the binding in IIS, then run wacs.exe again and select all the names.
HTTP error 403.14
The folder has no default document, such as index.html. Add this file or configure Default Document in inetmgr.
HTTP error 500.19
The website configuration is invalid or unreadable. Read the code displayed:
0x8007000d:web.configis malformed, or it uses a module that is not installed, such as URL Rewrite0x80070021: a section is locked at the server level0x80070005: IIS cannot access the folder or file, check the permissions withicacls
HTTP error 503
The application pool has probably stopped. Restart it, then check the Application log in Event Viewer if it stops again:
Get-WebAppPoolState -Name 'my-site'
Start-WebAppPool -Name 'my-site'The certificate does not renew
From C:\Program Files\simple-acme, run .\wacs.exe --renew --verbose, then read the logs. If the task has disappeared or reports an error, recreate it:
cd 'C:\Program Files\simple-acme'
.\wacs.exe --setuptaskscheduler