本地的ip实现https访问-OpenSSL安装+ssl正式的生成(Windows 系统)

1.下载OpenSSL软件

网站地址:Win32/Win64 OpenSSL Installer for Windows - Shining Light Productions

安装: 一直点击下一步就可以了

2.设置环境变量

在开始菜单右键「此电脑」→「属性」→「高级系统设置」→「环境变量」

在Path 中添加一个: xxxx\OpenSSL-Win64\bin → 「保存变量」

在通过该命令验证:openssl version

3.打开安装OpenSSL的位置

进入→ xxxx\OpenSSL-Win64\bin → 查看是否有"openssl.cnf"文件,如果没有就创建

openssl.cnf :

复制代码
[ req ]
default_bits       = 2048
default_keyfile    = key.pem
distinguished_name = req_distinguished_name
x509_extensions    = v3_ca
prompt             = yes
​
[ req_distinguished_name ]
C  = CN
ST = Beijing
L  = Beijing
O  = MyCompany
OU = MyUnit
CN = localhost
​
[ v3_ca ]
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer
basicConstraints = CA:true
​

4.创建cert.pem 和 key.pem

4.1 修改自己的安装位置,运行下面命令

复制代码
openssl req -new -x509 -days 365 -nodes ^
  -config "D:\app\OpenSSL-Win64\OpenSSL-Win64\bin\openssl.cnf" ^  ----修改为自己的安装位置
  -out cert.pem -keyout key.pem
​

4.2 按照提示,确认信息。

4.3 查看证书信息

复制代码
openssl x509 -in cert.pem -text -noout
​

cert.pem:证书文件

key.pem:私钥文件

相关推荐
阿白的白日梦2 天前
winget基础管理---更新/修改源为国内源
windows
小时前端2 天前
HTTPS 页面加载 HTTP 脚本被拦?同源代理来救场
前端·https
埃博拉酱6 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
唐宋元明清21887 天前
.NET 本地Db数据库-技术方案选型
windows·c#
加号37 天前
windows系统下mysql多源数据库同步部署
数据库·windows·mysql
tryCbest7 天前
Windows环境下配置pip镜像源
windows·pip
呉師傅7 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
百事牛科技7 天前
保护文档安全:PDF限制功能详解与实操
windows·pdf
一个人旅程~7 天前
如何用命令行把win10/win11设置为长期暂停更新?
linux·windows·经验分享·电脑
一个假的前端男7 天前
[特殊字符] Flutter 安装完整指南 Windows—— 2026最新版
windows·flutter