I could not find a single comprehensive guide on this issue so I thought I'd create a easy guide for those who find themselves with a similar situation.
I could not find a single comprehensive guide on this issue so I thought I'd create a easy guide for those who find themselves with a similar situation.
what I used:
vps with cpanel for front end.
amazon ec2 linux for back end node js app
follow this guide to install node js on ec2 https://www.youtube.com/watch?v=oHAQ3TzUTro
problem: node js app does not output anything on a https front end.
solution: install nginx server and use that to convert your http backend to a https subdomain so it can be displayed by the https front end.
example: Point your subdomain to the ip of your ec2 instance ex: api.mywebsite.com => 11.22.33.44
in this example a nodeJS app hosted on a ec2 instance on port 8080 with IP http://11.22.33.44:8080
currently the clock doesn't display anything on https://mywebsite.com. but it should work on http://mywebsite.com
get autossl certificates from cpanel for https://mywebsite.com. and https://api.mywebsite.com.
copy and paste the certificate block of text into a notepad
copy and paste the private key block of text into a notepad
Follow this guide to install nginx and redirect your node js app at http://11.22.33.44:8080 TO http://11.22.33.44 https://www.youtube.com/watch?v=_EBARqreeao
now connect to your ec2 instance with ssh.
sudo mkdir /etc/nginx/ssl
sudo chmod 700 /etc/nginx/ssl
this creates a folder to put your server.crt and server.key in.
sudo vim /etc/nginx/ssl/server.crt
copy your autossl certificate of api.mywebsite.com and save
sudo vim /etc/nginx/ssl/server.key
copy your autossl private key of api.mywebsite.com and save
sudo vim /etc/nginx/nginx.conf
now go back to your configuration file from the previous video and change the locations of your ssl certificate and ssl key
the bottom of your .conf file should look like this.
sudo nginx -s reload
now reload your server and https://api.mywebsite.com should load whatever is on http://11.22.33.44:8080 with a "connection is secure" tag. and your https front end https://mywebsite.com should display what is on https://api.mywebsite.com