Skip to content

Instantly share code, notes, and snippets.

@return1
Last active August 9, 2016 14:09
Show Gist options
  • Save return1/d5ba9e25459aeb82949ee415d87c4c67 to your computer and use it in GitHub Desktop.
Save return1/d5ba9e25459aeb82949ee415d87c4c67 to your computer and use it in GitHub Desktop.
Letsencrypt Certbot New Certificate for Nginx
# from https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-14-04
# add to nginx server config
location ~ /.well-known {
root /usr/share/nginx/html;
allow all;
}
ssl_certificate_key /etc/letsencrypt/live/www.domain.com/privkey.pem;
ssl_certificate /etc/letsencrypt/live/www.domain.co/fullchain.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.domain.co/fullchain.pem; # certificate for OCSP stapling
# request certificate
./certbot-auto certonly -a webroot --webroot-path=/usr/share/nginx/html -d domain.com -d www.domain.com
# test renew
./certbot-auto renew --dry-run
# renew
./certbot-auto renew --post-hook "service nginx reload"
# add cronjob
# add logrotate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment