Working on backend APIs using NodeJS is fun and really smooth as you can see yourself done a lot in less time than you could imagine. Being a frontend and mobile app developer its kinda weird when you work on backend APIs. Its a different concept for certain extent. While I was working on a project I decided let me do the backend myself. It was a learning curve but it was fun to learn Nodejs. So, developing an API is something that I have been doing for a while. Putting that API in production was not something that I have done before. Here comes the challenges!
I decided to install one of these APIs myself on a http://linode.com cloud server. I had many other options like digitalocean.com and AWS but I said let me support a philly startup since I am living 1.5 hours away from them.
While trying to install the server I came across the SSL certificate installation. You usually need one for any API so I had to either buy or just use an open source one. Of course I did not buy one since i could get it for free! Letsencrypt.org provides a free certificate that you can easily install by yourself on your linux server.
After going through their documentation and a couple online resources, the I have installed the ssl certificate successfully for the domain name. One of the things that I have faced and could not run it and when I turned the API Nodejs server on , all the other websites stopped. So the problem was that I was configuring both ports 443 and 8080 for the nodejs server and also for the other domains that were installed on the same sever. I spent a whole day trying to figure out what was wrong. Finally it was that when you run a nodejs api server then that by itself a web server and being accessed through the http protocol. My problem was solved after removing the node server’s configuration that has been done on nginx web server which hosted all the other domain names that I had. So, if you have a port 443 reserved for the nodejs SSL protocol then you can’t use the same port for any other nginx or Apache web servers.