Caddy Server stops working
After a full hard drive and running out of drive space
Reading time of 148 words
1 minute
1 minute
Reading time of 148 words ~ 1 minute
Did you find this article helpful? Please consider tipping me a coffee or three as a thank you.
Tip using Ko-fi or Buy Me a Coffee
Tip using Ko-fi or Buy Me a Coffee
Over the holidays a web server ran out of hard drive space. So I rebooted the system to clear out the temporary directory tmp/
to restore some space.
Unbeknownst to me, Caddy ran out of space in the middle of writing to its internal cache and would not start. Thanks to one of the internal Caddy JSON files being left incomplete, thus, malformed and corrupt!
After a brief panic from multiple attempts at restarting Caddy server, I discovered a simple solution, delete the internal cache and restart.
Steps to fix Caddy Server
0. optional, backup the cache just in case
sudo tar -czvf ~/caddy-local-backup.tar.gz /var/lib/caddy/.local/share/caddy/
1. change to root user
$ sudo bash
root@hostname:~#
2. change to the local caddy cache directory and delete the contents
cd /var/lib/caddy/.local/share/caddy/
rm --recursive --force *
3. exit root user
exit
4. start the caddy web server
$ sudo systemctl start caddy
Written by Ben Garrett