docker letsencrypt ssl

# 创建
docker run -it --rm --name certbot -v "app_nginx_ssl:/etc/letsencrypt" -v "/home:/mnt" certbot/certbot certonly -d hanhui.iguojin.com

# 更新
docker run -it --rm --name certbot -v "/root/resolv.conf:/etc/resolv.conf" -v "app_nginx_ssl:/etc/letsencrypt" -v "/home:/mnt" certbot/certbot renew

# 直接创建
docker run -it --rm --name certbot -v "app_nginx_ssl:/etc/letsencrypt" -v "/home:/mnt" certbot/certbot certonly  --webroot -w /mnt/hanhui.iguojin.com/public/ -d hanhui.iguojin.com -m qq@mail.com --agree-tos

letsencrypt域名无法访问,需要修修改dns
如下resolv.conf

nameserver 8.8.8.8 #修改成你的主DNS
nameserver 8.8.7.7 #修改成你的备用DNS

自动更新脚本

#!/bin/bash

time=$(date "+%Y-%m-%d %H:%M:%S")
echo $time

echo "nameserver 8.8.8.8" > /tmp/resolv.conf
echo "nameserver 8.8.7.7" >> /tmp/resolv.conf  

docker run --rm --name certbot -v "/tmp/resolv.conf:/etc/resolv.conf" -v "app_nginx_ssl:/etc/letsencrypt" -v "/home:/mnt" certbot/certbot renew

相关文章

此处评论已关闭