openssl genrsa -des3 -out server.key 1024 #生成私钥(key),设置密码
openssl req -new -key server.key -out server.csr # 生成request
cp server.key server.key.ori
openssl rsa -in server.key.ori -out server.key #去除私钥密码(否则启动nginx等也需要输入密码)
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt #自签名公钥
nginx配置
server {
listen 443;
server_name www.abc.com;
root /var/www/;
autoindex on;
ssl on;
ssl_certificate /etc/nginx/sslkey/server.crt;
ssl_certificate_key /etc/nginx/sslkey/server.key;
#access_log /var/log/nginx/www.abc.com-access.log main;
#error_log /var/log/nginx/www.abc.com-error.log warn;
}
cat /etc/ssl/openssl.cnf 修改democa为openssl工作目录
工作目录下
touch index.txt serial
chmod 666 index.txt serial
echo 01 > serial
mkdir -p newcerts private
ca
openssl genrsa -des3 -out ./private/ca.key 2048 #自建ca key
openssl req -x509 -new -days 3650 -key ./private/ca.key -out ca.crt # ca信息与证书
server
openssl genrsa -out ./server/server.key 1024
openssl req -new -key ./server/server.key -out ./server/server.csr
openssl ca -in ./server/server.csr -cert ./ca.crt -keyfile ./private/ca.key -out ./server/server.crt -days 3650 #用ca签名
[二] 不关联目录,签名
openssl x509 -req -sha256 -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。