docker pull certbot/certbot

nginx配置

server {
    listen 80;
    server_name example.com www.example.com;

    location /.well-known/acme-challenge/ {
        root /var/www/html;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}
docker run -it --rm --name certbot \
   -v /root/docker/ssl/letsencrypt:/etc/letsencrypt\
   -v docker_nginx_html:/var/www/html\
   certbot/certbot certonly --webroot\
   --webroot-path /var/www/html\
   --email [email protected]\
   --agree-tos \
   --no-eff-email \
   -d rn.haizhiguang.top
docker run -it --rm --name certbot \
   -v /root/docker/ssl/letsencrypt:/etc/letsencrypt\
   -v docker_nginx_html:/var/www/html\
   certbot/certbot renew  --webroot\
   --webroot-path /var/www/html\
   --quiet
Last Updated:
Contributors: haizhiguang