如何为本地主机创建自签名证书? [英] How can I create a self-signed cert for localhost?
问题描述
我已经完成了
通过启动mmc.exe
来解决这个问题.
然后去:
文件 -> 添加或删除管理单元 -> 证书 -> 添加 -> 计算机帐户 -> 本地计算机.点击完成.
展开Personal
文件夹,你会看到你的localhost
证书:
将证书复制到 Trusted Root Certification Authorities - Certificates
文件夹中.
最后一步是打开Internet Information Services (IIS) Manager
或直接打开inetmgr.exe
.从那里转到您的站点,选择 Bindings...
和 Add...
或 Edit...
.设置 https
并从下拉列表中选择您的证书.
您的证书现在是可信的:
I've gone through the steps detailed in How do you use https / SSL on localhost? but this sets up a self-signed cert for my machine name, and when browsing it via https://localhost I receive the IE warning.
Is there a way to create a self-signed cert for "localhost" to avoid this warning?
Since this question is tagged with IIS
and I can't find a good answer on how to get a trusted certificate I will give my 2 cents about it:
First use the command from @AuriRahimzadeh in PowerShell as administrator:
New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation "cert:LocalMachineMy"
This is good but the certificate is not trusted and will result in the following error. It is because it is not installed in Trusted Root Certification Authorities
.
Solve this by starting mmc.exe
.
Then go to:
File -> Add or Remove Snap-ins -> Certificates -> Add -> Computer account -> Local computer. Click Finish.
Expand the Personal
folder and you will see your localhost
certificate:
Copy the certificate into Trusted Root Certification Authorities - Certificates
folder.
The final step is to open Internet Information Services (IIS) Manager
or simply inetmgr.exe
. From there go to your site, select Bindings...
and Add...
or Edit...
. Set https
and select your certificate from the drop down.
Your certificate is now trusted:
这篇关于如何为本地主机创建自签名证书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!