skip to Main Content

My client’s websites runs a ssl generated by PLESK.

I used to run node.js with SSL thanks to:

var ssl = {
    key:  fs.readFileSync('/etc/letsencrypt/live/mysite.com/privkey.pem'),
    cert: fs.readFileSync('/etc/letsencrypt/live/mysite/cert.pem')
};

But I have no idea where PLESK did create these 2 files.

I tried with:

> /etc/ssl/certs/ssl-cert-snakeoil.pem
> /etc/ssl/private/ssl-cert-snakeoil.key

With no success.

Any idea on how to run nodejs with SSL generated by Plesk ?

3

Answers


  1. For example you have domain example.tld with Let’s Encrypt certificate name Lets Encrypt example.tld. You can download certificate file with private key from Plesk UI:

    plesk letsencrypt SSL

    Or you may try to find this certificate files by following request:

    # mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -e "select id, cert_file, ca_file, name from certificates where name like '%example%'"
    +----+-------------+-------------+----------------------------------------------+
    | id | cert_file   | ca_file     | name                                         |
    +----+-------------+-------------+----------------------------------------------+
    |  3 | cert-1lPfuj | cert-6oXdCf | Lets Encrypt example.tld                     |
    +----+-------------+-------------+----------------------------------------------+
    

    and as @El_Matella said check files cert-1lPfuj and cert-6oXdCf at /usr/local/psa/var/certificates:

    # ls -la /usr/local/psa/var/certificates/cert-*
    -r--------. 1 root root 5050 Jan  1 02:33 /usr/local/psa/var/certificates/cert-1lPfuj
    -r--------. 1 root root 1635 Jan  1 02:33 /usr/local/psa/var/certificates/cert-6oXdCf
    
    Login or Signup to reply.
  2. Pls. note, that Let’s Encrypt certificates, created over the Plesk Let’s Encrypt extension, place their original certificate files at:

    /usr/local/psa/var/modules/letsencrypt/etc/live/(sub)YOUR-DOMAIN.COM

    … while these files are symlinks to the archive of all created Let’s Encrypt certificates and these symlinks will always link to the latest ( and actual valid ) certifiate files ( pls. remember, that Let’s Encrypt certificates are only valid for a maximum of 90 days! ).

    In addition, pls. note as well, that you should use the “fullchain.pem” and not the “cert.pem”, because the “cert.pem” misses the needed root certificate. 😉

    Login or Signup to reply.
  3. I would recommend to use the NodeJS extension for Plesk (version Onyx) and the LetsEncrypt Extension to handle the verification, routing and automatic renewal of your Certificates. That Way you can to everything in the Plesk web interface and don’t even have to use the console.

    1. Install Git Extension
    2. Install NodeJS Extension
    3. Install LetsEncrypt
    4. configure Git and NodeJS for your Domain in Plesk
      1. including a public folder that is accessible through your Node App (Document Root)
      2. set the PORT your app is listening on to process.env.PORT
    5. activate LetsEncrypt for that Domain
    6. done!

    For more Details check out the Tutorial by Plesk:
    https://www.plesk.com/blog/product-technology/node-js-plesk-onyx/.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search