ssl证书申请与续租
1、下载插件acme.sh
curl https://get.acme.sh | sh -s email=example@163.com
2、设置申请机构,acme.sh 默认是使用 ZeroSSL 的 CA 进行免费证书的签发;如果你希望使用 Let's Encrypt 的免费证书,则需要执行如下命令切换到使用 Let's Encrypt 的 CA 服务器进行证书申请和签发
acme.sh --set-default-ca --server letsencrypt
3、申请证书
acme.sh --issue -d www.liudu.love --webroot /www/wwwroot/www.liudu.love
4、安装证书
acme.sh --install-cert -d www.liudu.love --key-file /root/key/key.pem --fullchain-file /root/key/cert.pem
5、配置nginx证书位置
listen 443 ssl;
server_name love.liudu.love;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/love.liudu.love;
ssl_certificate /root/key/lovecert.pem;
ssl_certificate_key /root/key/lovekey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
6、定时续租,默认安装acme.sh后会自动生成定时任务
acme.sh --renew -d love.liudu.love --force
阅读量:42次,本文由 六度 创作,采用 知识共享署名4.0 国际许可协议进行许可。
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。