Skip to content

Instantly share code, notes, and snippets.

@bloodyKnuckles
Last active November 3, 2016 14:50
Show Gist options
  • Save bloodyKnuckles/981bde40785df4354e9f to your computer and use it in GitHub Desktop.
Save bloodyKnuckles/981bde40785df4354e9f to your computer and use it in GitHub Desktop.
Node.js https letsencrypt tls/ssl certificate setup on CentOS 7.1 x64 (Digital Ocean)
// (on the server command line, get certificate files)
// git clone https://github.com/letsencrypt/letsencrypt
// cd letsencrypt
// ./letsencrypt-auto certonly
// (in the web server directory)
// vim index.js
var https = require('https')
var fs = require('fs')
https.createServer({
key : fs.readFileSync('/etc/letsencrypt/live/<domain>/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/<domain>/fullchain.pem')
},
function (req, res) {
res.writeHead(200)
res.end("booya!\n")
}).listen(443)
// node index.js
// curl https://<domain>/
// booya!
@bloodyKnuckles
Copy link
Author

To renew:

./letsencrypt-auto certonly

...duh!

@bloodyKnuckles
Copy link
Author

Apparently I created a lineage branch because there's a mydomainname-0001 directory now. And the original lineage expired so the site SSL quit working until I updated it's credentials to include the "-0001". I'm leaving it for now since it works but I'm thinking I'll delete the "-0001" next time it expires and try to renew the original lineage.

@bloodyKnuckles
Copy link
Author

Deleted the "-0001" branches:

rm -rf /etc/letsencrypt/live/tuitionpool.org-0001/
rm -rf /etc/letsencrypt/archive/tuitionpool.org-0001/
rm /etc/letsencrypt/renewal/tuitionpool.org-0001.conf

To renew:

cd ~/cerbot
./certbot-auto renew

@bloodyKnuckles
Copy link
Author

bloodyKnuckles commented Aug 14, 2016

To renew:

pkill node
cd ~/certbot
./certbot-auto renew
# restart node

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