[root@localhost ~]# openssl version OpenSSL 1.0.2k-fips 26 Jan 2017
得知当前openssl版本为1.0.2K
生成一个nginx私钥
#加密方式为aes128 生成一个2048位的秘钥
#openssl genrsa -aes128 -out nginx.key 2048
Generating RSA private key, 2048 bit long modulus ........................................................+++ .....................................+++ e is 65537 (0x10001) Enter pass phrase for nginx.key:
Verifying - Enter pass phrase for nginx.key:
通过nginx私钥来生成公钥
#openssl rsa -in nginx.key -pubout -out nginx_pub.key #Enter pass phrase for nginx.key: #writing RSA key
通过nginx私钥生成nginx.crs
openssl req -new -key nginx.key -out nginx.csr Enter pass phrase for nginx.key:
通过nginx私钥生成nginx证书
方法:在得到key文件后,执行以下命令: openssl req -new -x509 -days 3650 -key nginx.key -out nginx.crt 如果不想填写那些注册信息,执行以下命令: openssl req -new -x509 -days 3650 -key nginx.key -out nginx.crt subj "/C=CN/L=shanghai/O=Feisty Duck Ltd/CN=www.tao.xyz