Sign inSign up

william0wang/caddy

By william0wang

Updated over 5 years ago

caddy with cloudflare dns

Image
0

326

william0wang/caddy repository overview

caddy-cloudflaredns

Please see the official Caddy Docker Image for deployment instructions.

Few things to note:

  1. You should add CLOUDFLARE_EMAIL and CLOUDFLARE_API_TOKEN as environment variables to your docker run command. Example:

    docker run -it --name caddy \
      -p 80:80 \
      -p 443:443 \
      -v caddy_data:/data \
      -v caddy_config:/config \
      -v $PWD/Caddyfile:/etc/caddy/Caddyfile \
      -e [email protected] \
      -e CLOUDFLARE_API_TOKEN=12345 \
      -e ACME_AGREE=true \
      slothcroissant/caddy-cloudflaredns 
    

    You can obtain your Cloudflare API token via the Cloudflare Portal. To create a API token with minimal scope, the following steps are needed:

    1. Log into your dashboard, go to account settings, create API token

    2. grant the following permissions:

      • Zone / Zone / Read
      • Zone / DNS / Edit
  2. You should add the following to your Caddyfile as the tls directive. Note that I haven't figured out why the using {env.CLOUDFLARE_EMAIL} for the email address didn't work, so for now I've got it manually declared:

    tls [email protected] { 
      dns cloudflare {env.CLOUDFLARE_API_TOKEN}
    }
    

Tag summary

Content type

Image

Digest

Size

25.2 MB

Last updated

over 5 years ago

docker pull william0wang/caddy