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

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