openssl生成自签证书

步骤

#创建两个文件 cn.cnf和server.cnf ,分别插入下面的内容

bash 复制代码
[ req ]
default_bits       = 4096
distinguished_name = req_distinguished_name
req_extensions     = req_ext
prompt             = no

[ req_distinguished_name ]
countryName                = CN
stateOrProvinceName        = BeiJing
localityName               = BeiJing
organizationName           = WeiOrg
organizationalUnitName     = WeiUnit
commonName                 = localhost

[ req_ext ]
subjectAltName = @alt_names

[ alt_names ]
DNS.1 = localhost
DNS.2 = example.com #配置域名的写法
IP.1  = 127.0.0.1
IP.2  = 192.168.110.9 #配置ip写法

分别执行下面的命令

bash 复制代码
openssl genpkey -algorithm RSA -out ca.key -pkeyopt rsa_keygen_bits:4096

openssl req -x509 -new -key ca.key -out ca.crt -days 3650 -config ca.cnf

openssl genpkey -algorithm RSA -out server.key -pkeyopt rsa_keygen_bits:4096

openssl req -new -key server.key -out server.csr -config server.cnf

openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 365 -extfile server.cnf -extensions req_ext
安装证书过程

待后续...

相关推荐
未知违规用户8 小时前
大模型项目: 学习FastAPI 服务器开发
服务器·人工智能·python·学习·fastapi
ljj2535575051__8 小时前
LVS(Linux virual server)
服务器·网络·lvs
Ivan CloudBay9 小时前
服务器关机后,网站会发生什么?
运维·服务器
程序员小崔日记16 小时前
20块钱注册一年 .COM 域名!Spaceship 最新优惠教程,支付宝即可付款(附优惠码)
服务器·腾讯云·域名
实心儿儿17 小时前
Linux —— 进程间关系和守护进程
linux·运维·服务器
林浅不想努力18 小时前
LVS知识点总结
服务器·云原生·lvs
Dawn-bit19 小时前
Linux磁盘管理详解
linux·运维·服务器·计算机网络·云计算
三言老师1 天前
CentOS7.9:Redis‑Cluster集群部署结构化实战教程
linux·运维·服务器·数据库
technology_x1 天前
2026年财务报表分析软件测评:兼容与安全解析
java·服务器·前端
海域云-罗鹏1 天前
分支访问总部ERP卡顿?如何部署SD-WAN组网解决方案
服务器·网络·安全