如何为本地主机创建自签名证书?

编程入门 行业动态 更新时间:2024-10-22 23:26:15
本文介绍了如何为本地主机创建自签名证书?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经完成了

通过启动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 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:

更多推荐

如何为本地主机创建自签名证书?

本文发布于:2023-11-02 14:49:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552688.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:证书   主机

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!