openssl生成nginx ssl证书的简单方法

root@172-17-218-79 \~# mkdir cert

root@172-17-218-79 \~# cd cert/

root@172-17-218-79 cert# openssl genrsa -out server.key 1024

Generating RSA private key, 1024 bit long modulus (2 primes)

......+++++

.........................................+++++

e is 65537 (0x010001)

root@172-17-218-79 cert# openssl req -new -key server.key -out server.csr

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.


Country Name (2 letter code) AU:

State or Province Name (full name) Some-State:

Locality Name (eg, city) \[\]:

Organization Name (eg, company) Internet Widgits Pty Ltd:

Organizational Unit Name (eg, section) \[\]:

Common Name (e.g. server FQDN or YOUR name) \[\]:server

Email Address \[\]:

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password \[\]:

An optional company name \[\]:

root@172-17-218-79 cert# openssl x509 -req -in server.csr -out server.crt -signkey server.key -days 9999

Signature ok

subject=C = AU, ST = Some-State, O = Internet Widgits Pty Ltd, CN = server

Getting Private key

root@172-17-218-79 cert# ll

total 12

-rw-r--r-- 1 root root 818 Dec 6 15:29 server.crt

-rw-r--r-- 1 root root 627 Dec 6 15:29 server.csr

-rw------- 1 root root 887 Dec 6 15:28 server.key

思路:

  1. 生成私钥

  2. 生成请求文件

  3. 签名+x509封装

相关推荐
西索斯coding27 分钟前
qwen3.8-max-0902 和 minimax-m3 改真实仓库差多少?2026 年 50 个缺陷复现实测框架
java·服务器·网络·ai
云-缩影33 分钟前
拆解微信小程序后端架构:ECS、RDS、SSL 和 VPC 怎么配合
微信小程序·架构·ssl
码途行者41 分钟前
Linux 服务器 Golang 安装及环境变量配置
linux·运维·服务器
雪落漂泊1 小时前
Linux进程(三)概念:进程优先级与进程切换篇
linux·运维·服务器
拂拉氏1 小时前
【知识讲解】 Linux信号与可重入函数的认识
linux·运维·服务器
pikapika~~~1 小时前
计算机网络八股
服务器·网络·计算机网络
djjjx.1 小时前
Linux进程篇(十二):从零构建属于你的自定义 Shell 解释器
linux·运维·服务器
云川之下2 小时前
[ensp] 交换机入门配置例子(带vlan)
运维·服务器·网络
ShineWinsu3 小时前
对于Qt:QLCDNumber常见属性以及QTimer的解析
服务器·数据库·c++·qt·gui·qtimer·qlcdnumber
SEO-狼术3 小时前
Aspose.Email for .NET 26 Crack
运维·服务器