替换集群节点的 SSL 证书
替换集群节点的 SSL 证书
2024年4月26日
ID 234129
要替换集群节点的 SSL 证书:
- 通过 SSH 登录到要为其替换证书的节点的管理控制台。
- 将证书文件 (cert.pem) 和私钥文件 (key.pem) 放在
/root
目录中。 - 切换到 Web 服务器配置文件目录:
cd /etc/nginx/ksmg
- 创建当前证书和私钥的备份副本:
cp -p webapi.crt webapi.crt.backup
cp -p webapi.key webapi.key.backup
- 替换证书和私钥文件的内容:
cat /root/cert.pem > webapi.crt
cat /root/key.pem > webapi.key
- 设置证书的所有者和私钥的访问权限:
chown root:root webapi.crt
chmod 644 webapi.crt
chown kluser:root webapi.key
chmod 600 webapi.key
- 重新启动 nginx 服务:
systemctl restart nginx
- 检查 nginx 服务的状态:
systemctl status nginx
该服务的状态必须为
running
。 - 在浏览器中打开集群节点的 Web 界面。如果证书已被成功替换,则不会显示不安全连接警告。
- 如果替换成功,请删除
/root
目录中的原始证书和私钥文件:rm -f /root/cert.pem /root/key.pem
集群节点的 SSL 证书即被替换。如果要替换多个集群节点上的证书,则必须在每个节点上按照分步说明进行操作。
Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.