OpenSSL生成自签名通配符证书

1.生成私钥

bash 复制代码
# 这里自己根据域名调整
openssl genrsa -out example.com.key 2048

2.创建证书签名请求 (CSR)

bash 复制代码
# 根据域名跳转
openssl req -new -key example.com.key -out example.com.csr

3.填写信息

Country Name (C): CN

State or Province Name (ST): Zhejiang

Locality Name (L): Hangzhou

Organization Name (O): example

Organizational Unit Name (OU): Dev

Common Name (CN): *.example.com

4.生成配置文件添加 SAN(非常关键)

创建一个文件:example.com.ext

bash 复制代码
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = *.example.com
DNS.2 = example.com

5.生成自签名证书

bash 复制代码
openssl x509 -req -in example.com.csr -signkey example.com.key -out example.com.crt -days 3650 -extfile example.com.ext

有效期10年(3650天)

🔹 得到两个文件:

  • example.com.crt(证书)

  • example.com.key(私钥)

相关推荐
Sinclair2 天前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
Rockbean3 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪3 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩3 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
海天鹰3 天前
【免费】PHP主机=域名+解析+主机
服务器
DianSan_ERP3 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅3 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒3 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器
芝士雪豹只抽瑞克五3 天前
Nginx 高性能Web服务器笔记
服务器·nginx
失重外太空啦3 天前
Tomcat
java·服务器·tomcat