This guide to install SSL cert on Nginx as a reverse proxy, and forward the request to a node app
https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/
$ apt-get update
$ sudo apt-get install certbot
$ apt-get install python-certbot-nginx
Add the domain to Nginx conf
$ sudo vim /etc/nginx/sites-enabled/default
Inside of default conf file add the following to redirect the domain to the localhost port 4444
server {
listen 80;
server_name myserver.com;
location / {
proxy_pass http://127.0.0.1:4444;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Install http-server
to serve the static folder ~/www
for verification by Let's encrypt
$ npm i -g http-server
$ http-server -p 4444 ./www
Request the SSL cert and configure Nginx at the same time
$ sudo certbot --nginx -w ./www -d myserver.com
the -w
param tells certbot where the static folder is to add a file to response to its verification