在 CentOS 上“替换证书”通常指的是替换 Web 服务(如 Nginx / Apache)、系统级证书 或 服务通信证书(如 HTTPS、LDAP、邮件等)。下面按常见场景给你说明。
一般包含:
xxx.crt(证书)xxx.key(私钥)chain.crt / fullchain.crtcp your_domain.crt /etc/nginx/ssl/your_domain.crt
cp your_domain.key /etc/nginx/ssl/your_domain.key
ssl_certificate /etc/nginx/ssl/your_domain.crt;
ssl_certificate_key /etc/nginx/ssl/your_domain.key;
nginx -t
systemctl restart nginx
cp your_domain.crt /etc/pki/tls/certs/your_domain.crt
cp your_domain.key /etc/pki/tls/private/your_domain.key
SSLCertificateFile /etc/pki/tls/certs/your_domain.crt
SSLCertificateKeyFile /etc/pki/tls/private/your_domain.key
httpd -t
systemctl restart httpd
cp your_ca.crt /etc/pki/ca-trust/source/anchors/
update-ca-trust extract
如果原来是 certbot 签发的:
certbot renew
# 或强制
certbot renew --force-renewal
Nginx/Apache 会自动 reload。
chmod 600 your_domain.key
chown root:root your_domain.key
ss -lntp | grep 443
你也可以告诉我具体是哪一种:
我可以给你更精确的命令。