Configure HTTPs on server without custom domain
I was working on a quick project recently and I ran into an issue — I wanted to configure HTTPs for my backend API. It was a small project and as such I had no need to purchase a domain name. I just needed a way to configure HTTPs on that server without buying a SSL (Secure Sockets Layer) certificate and without a domain name.
After searching the internet for a bit, I came across Caddy — an open source web server with automatic HTTPs. In this article, I will walk you through how to use Caddy and nip.io to configure HTTPs on your server without getting a custom domain name.
When I ran into this problem and for this article, I will be using AWS EC2 instance, however you can do the same on any Linux server.
Caddy 2 is a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go
— Caddy
Installation
Caddy provides various installation options for various Linux distros. You can check if Caddy is available for your operating system and how to install for your operating system here. As at the time of writing this article, I am using a Linux Server on AWS. Installation is as simple as these commands:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf…