Overview
This is an article in a series of Sitecore how-to articles. These articles are meant to be quick guides to accomplish various tasks within Sitecore. The how-to articles have proven to be very helpful internally at One North https://www.onenorth.com. These articles assume working Sitecore knowledge. I just wanted to share the articles with the community. Hopefully you find them helpful.
How-To
In order to setup a https site locally on your machine, you will need to create a self signed certificate and add SSL settings to your IIS site.
Step-by-step guide
Create the self-signed certificate via IIS:
Note: This method will not allow you to control the domain name(s) the certificate is for. IIS will use your machine name by default.
- Open IIS Manager
- Click the root node
- Double click the Server Certificates feature
- In Server Certificates Feature window => Actions pane: Create Self-Signed Certificate
- Specify friendly name for certificate. Your machine name works.
- Click ok
Create the self-signed certificate via PowerShell
- Open PowerShell as an administrator
- Execute the following command
New-SelfSignedCertificate -DnsName "my.local.domain" -CertStoreLocation cert:\LocalMachine\My -FriendlyName "My Local Cert Name"
Note: The
-DnsName
parameter of theNew-SelfSignedCertificate
cmdlet takes an array of strings. You can add multiple domain names to a single certificate.New-SelfSignedCertificate -DnsName "mysite", "mysite.local", "mysite.siteco.re" -CertStoreLocation cert:\LocalMachine\My -FriendlyName "My Local Cert Name"
Note: The
-NotAfter
parameter takes a DateTime, allowing you to set an expiration date for the certificate.New-SelfSignedCertificate -DnsName "mysite" -CertStoreLocation cert:\LocalMachine\My -FriendlyName "My Local Cert Name" -NotAfter (Get-Date).AddYears(10)
See the documentation for New-SelfSignedCertificate for more details. Related article here.
Bind the new certificate to your website
- Open IIS Manager
- Click the site you want to add the certificate to.
- Under “Edit Site” on the right-hand menu, click on Bindings
- Click Add
- Type: HTTPS
- IP Address: All Unassigned
- Port: 443
- Hostname: your site name
- SSL Certificate: choose your self-signed certificate you just created
Note: If you want to force SSL, double click on SSL Settings feature => check Require SSL