Created
November 24, 2017 17:19
-
-
Save jlouros/8c17e45cf9c8a2286a78cfd8f6bada5f to your computer and use it in GitHub Desktop.
Create self-signed certificate for localhost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Replace "Subject" with CN (Common Name) and/or SAN (Subject Alternative Name) | |
New-SelfSignedCertificate -DnsName localhost -CertStoreLocation Cert:\LocalMachine\My | |
#Replace "Password" with your password. | |
$CertPassword = ConvertTo-SecureString -String "yourpassword" -Force –AsPlainText | |
#Replace "Thumbprint" with certificate Thumbprint and "path-to-pfx" the location where the certificate PFX will be saved. | |
Export-PfxCertificate -Cert cert:\LocalMachine\My\{thumbprint} -FilePath {path-to-cert-output.pfx} -Password $CertPassword | |
# open IIS manager | |
# set website binding | |
# use 'https', Host name: 'locahost', select your localhost certificate | |
# [Ctrl] + [r] | |
# mmc.exe | |
# [Ctrl] + [m] | |
# select 'Certificates', 'Add >', 'Computer account', 'Next >', 'Finish', 'OK' | |
# from 'Certificates' navigate to 'Personal/Certificates' | |
# right-click 'localhost' and 'Copy' | |
# from 'Certificates' navigate to 'Trusted Root Certification Authorities/Certificates' | |
# right-click, 'Paste' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
if you have multiple 'localhost' certificates, delete them and try again
references:
https://www.youtube.com/watch?v=zTlc5Z59FpA