Skip to content

Instantly share code, notes, and snippets.

@kkdai
Forked from pahud/gen_le_cert.sh
Created October 16, 2016 12:32
Show Gist options
  • Save kkdai/30597f842336206ba75ec077371608c3 to your computer and use it in GitHub Desktop.
Save kkdai/30597f842336206ba75ec077371608c3 to your computer and use it in GitHub Desktop.
letsencrypt cert generator with docker
#!/bin/bash
#
# 1. create a EC2 instance with public IP
# 2. create a A RR in route53 pointing your.domain.com to the public IP
# 3. make sure HTTP/HTTPS ports(80 443) are public to all in security group of this EC2 instance
# 4. make sure docker daemon is running in this EC2 instance
# 5. run this script !
# 6. keys/cert will be generated under /root/letsencrypt/etc/live/
mkdir -p /root/letsencrypt/log /root/letsencrypt/lib /root/letsencrypt/etc
email='your_email@gmail.com'
domain='your.domain.com'
docker run --rm -it -p 80:80 -p 443:443 -v "/root/letsencrypt/log:/var/log/letsencrypt" -v "/var/www/:/var/www/" -v "/root/letsencrypt/etc:/etc/letsencrypt" -v "/root/letsencrypt/lib:/var/lib/letsencrypt" lojzik/letsencrypt certonly --email $email -d $domain --standalone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment