Skip to content

Instantly share code, notes, and snippets.

@metakirby5
Last active December 14, 2017 23:37
Show Gist options
  • Save metakirby5/a27ff54aa63f2c042a550614a0984cce to your computer and use it in GitHub Desktop.
Save metakirby5/a27ff54aa63f2c042a550614a0984cce to your computer and use it in GitHub Desktop.
Automatically update letsencrypt certificate for all nginx domains
#!/usr/bin/env bash
# Updates nginx letsencrypt domains by server_name.
/opt/letsencrypt/letsencrypt-auto \
certonly -a webroot --webroot-path=/var/www/ssl \
$(grep -hro '^\s*server_name\s\+[a-zA-Z0-9.-]\+' /etc/nginx/ |
sort | uniq | awk '{print "-d", $2}')
@metakirby5
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment