I am using express to create an API, to use HTTPS, I have the library https and creating a HTTPS secured API but when certificates automatically renew, the API starts to fail so i am trying to manually renew letsencrypt certificate every week, my question is. Where can I find the Certificate and RSA Key Dreamhost generates for my site? how to renew let’s encrypt manually through a cron job? please help!
The certificates can be accessed from the Control Panel’s SSL/TLS Certificates page (press Settings on a domain):
Normally on DH’s Shared/VPS hosting, you’d run an Express app under Passenger, and the web server (Apache or Nginx) would automatically handler certificates.
I have used those certificates but when they expire i get: Error: SSL peer certificate or SSH remote key was not OK and this occurs because the Certificate and the RSA Key change, I would like to create a cron job to copy the new certificate to my app and restart the server, but I don’t know where do Dreamhost store those files? or is my reasoning wrong? i am using typescript/nodejs and express to create an API
I don’t think there is a way to access the certs using the Dreamhost API nor the file-system, but you might ask DH Support about it.
If you’re using a VPS or Dedicated server, then another way to setup an Express app/api is to add a reverse proxy:
The reverse proxy would map an URL like
example.com/api to an Express app running at
localhost:8001. The web server would handle HTTPS/certs, so the Express server running on port 8001 can run unencrypted (be sure it is only locally accessible).