Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kernel-sanders
Last active December 10, 2015 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kernel-sanders/0c22ab331a79e13e1b21 to your computer and use it in GitHub Desktop.
Save kernel-sanders/0c22ab331a79e13e1b21 to your computer and use it in GitHub Desktop.
Nginx config and commands for let's encrypt
# This should be in your nginx config
# You can put the location block in whichever server blocks need a let's encrypt cert
server {
listen 80;
server_name sub.domain.tld sub2.domain.tld;
location '/.well-known/acme-challenge' {
default_type "text/plain";
root /tmp/letsencrypt-auto;
}
}
# Run these commands
export DIR=/tmp/letsencrypt-auto
export DOMAINS="-d sub.domain.tld -d sub2.domain.tld"
mkdir -p $DIR && ./letsencrypt-auto certonly --server https://acme-v01.api.letsencrypt.org/directory -a webroot --webroot-path=$DIR --agree-dev-preview $DOMAINS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment