Last active
January 22, 2020 19:40
-
-
Save kevincharm/edf44072b39125769b85 to your computer and use it in GitHub Desktop.
CentOS 7 Let's Encrypt SSL certs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Automates letsencrypt SSL cert generation/installation on CentOS 7 w/nginx | |
# MIT, use at your own risk blabla | |
[email protected] | |
DOMAIN_NAME=foo.bar.com | |
sudo su - root | |
cd ~ | |
git clone https://github.com/letsencrypt/letsencrypt | |
cd letsencrypt | |
./letsencrypt-auto | |
systemctl stop nginx | |
./letsencrypt-auto certonly --standalone --email $EMAIL -d $DOMAIN_NAME --agree-tos --text | |
# This step is optional, specific to my setup. First pem file is ssl_certificate_key and second is ssl_certificate | |
ln -s /etc/letsencrypt/live/${DOMAIN_NAME}/privkey.pem /etc/ssl/${DOMAIN_NAME}.key | |
ln -s /etc/letsencrypt/live/${DOMAIN_NAME}/fullchain.pem /etc/ssl/${DOMAIN_NAME}.crt | |
systemctl start nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Renew certs | |
[email protected] | |
DOMAIN_NAME=foo.bar.com | |
cd ~ | |
cd letsencrypt | |
systemctl stop nginx | |
./letsencrypt-auto certonly --standalone --email $EMAIL -d $DOMAIN_NAME --agree-tos --renew-by-default --text | |
systemctl start nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment