Let's Encrypt On Raspberry Pi

Looks like I have it all working! I did run into one other problem. Setting the environmental variables for the Cloudflare DNS challenge in /etc/profile prevented them from being read when launching Caddy on boot in rc.local (I’m guessing /etc/profile is read after rc.local executes, so it can’t see the variables)

Instead, I defined the variables in the rc.local file. Which now has these lines:

export CLOUDFLARE_API_KEY=“my api key”
export CLOUDFLARE_EMAIL=“my email address”

caddy -conf /etc/caddy/Caddyfile -http-port 9080 -log /home/pi/log.txt &

Everything seems to be working quite well.

Do you know if using “sudo killall caddy” is bad practice? I’m needing a way to stop/restart Caddy after changing my Caddyfile, and that’s the best way I’ve found so far without actually rebooting the Raspberry Pi.

1 Like