Converting Caddyfile from v1 to v2

I want to jump on the v2 release. How will I go to migrate this v1 Caddyfile to v2?

zt.netbros.com {
        log /var/log/caddy/zt.netbros.net.log {
                rotate_size 1
                rotate_age  7
                rotate_keep 1
        }

	header / {
                Strict-Transport-Security "max-age=31536000"
                X-XSS-Protection "1; mode=block"
                X-Content-Type-Options "nosniff"
                X-Frame-Options "DENY"
                -Server
        }

        tls {
                key_type rsa4096
                protocols tls1.2
                must_staple
        }

        proxy / http://127.0.0.1:3030 {
                transparent
        }

}

www.moorthy.me {
        gzip

        header / {
                Strict-Transport-Security "max-age=31536000"
                X-XSS-Protection "1; mode=block"
                X-Content-Type-Options "nosniff"
                X-Frame-Options "DENY"
                -Server
        }

        tls {
                key_type rsa4096
                protocols tls1.2
                must_staple
        }

        redir https://moorthy.me{uri}

}

moorthy.me {
        root /var/www/moorthy.me
        gzip

       log /var/log/caddy/moorthy.me.log {
                rotate_size 1
                rotate_age  7
                rotate_keep 1
        }

        header / {
                Strict-Transport-Security "max-age=31536000"
                X-XSS-Protection "1; mode=block"
                X-Content-Type-Options "nosniff"
                X-Frame-Options "DENY"
                -Server
        }

        tls {
                key_type rsa4096
                protocols tls1.2
                must_staple
        }
        
}

TIA!

Hi @Fastidious - take a look at our upgrade guide, that should help! Upgrading to Caddy 2 — Caddy Documentation

Which approach do you recommend I take? I only have one VM, production. What is the best way to migrate to v2, while keeping uptime on current v1? Play with it in a subdomain, and run Caddy v2 on a different port? Thanks again!

Sure, that’s a good plan. But I’d recommend using a separate machine entirely.

All done now. Used same machine, almost no downtime. The changes are rather minimal, so it was relatively simple when I focused my attention to it. Thanks!

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.