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

相关推荐
存储服务专家StorageExpert17 分钟前
墙裂推荐:console, CLI命令行和日志使用字体-Cascadia
运维·服务器·netapp存储·存储维护·emc存储
菜鸟康1 小时前
Linux系统编程——理解系统内核中的信号捕获
linux·运维·服务器
张明奇-琦玉1 小时前
Boost之log日志使用
linux·服务器·算法
MaoSource2 小时前
Debian 12.0安装nginx
服务器·nginx·debian
Channing Lewis2 小时前
salesforce Portal User Visibility and Site User Visibility
运维·服务器·salesforce
zr5268554473 小时前
IEC103 转 ModbusTCP 网关(三格电子)
运维·服务器·网络
是程序喵呀4 小时前
Nginx 进阶详解
运维·nginx
阿7_QuQ4 小时前
mac远程控制另一台mac怎么操作?
运维·服务器·macos
Ven%4 小时前
llamafactory报错:双卡4090GPU,训练qwen2.5:7B、14B时报错GPU显存不足(out of memory),轻松搞定~~~
运维·服务器·人工智能·python·深度学习·机器学习·llama
西风未眠4 小时前
界面化管理Nginx的工具—NginxUI简介与搭建
运维·nginx·界面化管理·界面管理nginx