November 06, 2025

Migrate from Nginx to Caddy for SSL auto-renewal in Amazon AWS EC2

 Dear friends,

Today, we will see a simple migration with less configuration of SSL auto-renewal.

I was using Nginx for SSL auto-renewal using certbot. Every 90 days, the renewal code should run, I made one more service it.

I have come across Caddy, which does an auto-renewal of SSL automatically with certbot. Reducing efforts and making the system smooth.

Follow the steps below

Stop and disable the Nginx

sudo systemctl stop nginx

sudo systemctl disable nginx

Install the Caddy

In EC2, if you are running Amazon Linux, then execute the following to install Caddy.

    sudo yum -y install yum-plugin-copr

    sudo yum -y copr enable @caddy/caddy epel-8-$(arch)

    sudo yum -y install caddy

Edit and configure the Caddyfile

Usually, it will be in the path /etc/caddy/Caddyfile

sudo vi /etc/caddy/Caddyfile

I have only one server that is running locally. So, my configuration is easy

domain_name {

    reverse_proxy localhost:port

}

You can configure more with your existing Nginx sites-enabled reference.

Happy SSLing.

If you like the blog or want to comment, kindly reach out to psrdotcom@gmail.com


Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com