-2

I have a node application on a EC2 instance running on Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-6a003c0f, which I want to get a ssl certificate from Let's Encrypt with Certbot.

I am in doubt what is the right software and system to select from the list when setting up Certbot in my case ? https://certbot.eff.org/

Please help me.

July333
  • 251
  • 1
  • 6
  • 15

1 Answers1

0

For node.js you need to run letsencrypt in manual mode and then add the certificates to your code.

The following command will download letsencrypt and generate your certificates. Modify with your domain name and email address.

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
./letsencrypt-auto certonly --manual --email admin@example.com -d example.com

Letsencrypt will create a directory containing four files. In the following example, the file fullchain.pem is not used. Read the documentation for details on each file.

Location: /etc/letsencrypt/live/example.com

Note: Read the output from letsencrypt for the actual file location

Example node.js:

var https = require('https');
var fs = require('fs');

    var options = {
      key: fs.readFileSync('/etc/letsencrypt/live/example.com/privkey.pem'),
      cert: fs.readFileSync('/etc/letsencrypt/live/example.com/cert.pem'),
      ca: fs.readFileSync('/etc/letsencrypt/live/example.com/chain.pem')
    };

    https.createServer(options, function (req, res) {
      res.writeHead(200);
      res.end("hello world\n");
    }).listen(8443);

Test with a web browser to https://example.com:8443/

John Hanley
  • 74,467
  • 6
  • 95
  • 159