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封装

相关推荐
Avan_菜菜3 天前
FRP 内网穿透完整实战:从 HTTP 映射到 HTTPS 自签代理
运维·nginx·https
zzzzzz3105 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
ping某7 天前
为什么 Nginx 明明监听了 80,转发后端时却用了 4xxxx 端口?
后端·nginx
大树889 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
小宇宙Zz9 天前
Maven依赖冲突
java·服务器·maven
古城小栈9 天前
Unix 与 Linux 异同小叙
linux·服务器·unix
程序员mine9 天前
HTTPS-TLS加密与证书完全指南(中)
网络协议·https·ssl
程序猿阿伟9 天前
《Chrome离线扩展安装的底层逻辑与场景落地指南》
服务器·网络·chrome
凡人叶枫9 天前
Effective C++ 条款42:了解 typename 的双重意义
java·linux·服务器·c++
AC赳赳老秦9 天前
用 OpenClaw 搭建服务器故障应急响应系统,自动处理 80% 常见运维故障
android·运维·服务器·python·rxjava·deepseek·openclaw