免费 SSL 证书申请指南 | 支持 ZeroSSL、acme.sh、Certbot、阿里云/腾讯云
在您的服务器终端执行以下命令:
openssl genrsa -out private.key 2048
openssl req -new -key private.key -out domain.csr
openssl req -new -newkey rsa:2048 -nodes -keyout private.key -out domain.csr -subj "/C=CN/ST=Beijing/L=Beijing/O=Personal/CN=example.com"
💡 将 example.com 替换为你的实际域名
cat domain.csr
curl https://get.acme.sh | shacme.sh --sign-csr -d 你的域名 --csr domain.csr --fullchain-file fullchain.pemacme.sh --issue --dns -d 你的域名sudo apt install certbotsudo certbot certonly --standalone -d 你的域名sudo certbot --nginx -d 你的域名server {
listen 443 ssl http2;
server_name 你的域名;
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/private.key;
location / {
root /var/www/html;
}
}
<VirtualHost *:443>
ServerName 你的域名
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/private.key
</VirtualHost>
Q: 证书有效期多长?
A: ZeroSSL/acme.sh 90天,支持自动续期;阿里云/腾讯云 1年。
Q: 通配符证书怎么申请?
A: 域名填 *.example.com,需要 DNS 验证。
Q: 私钥丢了怎么办?
A: 私钥无法找回,需要重新生成重新申请。
Q: 证书安装后浏览器提示不安全?
A: 检查证书链是否完整,域名是否匹配。