Given Caddy 2 is a fairly young web server, the documentation around update existing the Caddy 2 installation is not very easy to find, especially when Caddy was not installed via any package manager. This guide aims to show you how to update Caddy to the latest version. If you have not installed Caddy, you can follow this guide to install Caddy.
Stop the Currently Running Caddy
Before upgrading, we will have to stop the currently running Caddy. If you installed the Caddy server with the Daemon, you can stop the currently running instance by:
$ sudo systemctl start caddy
Download Latest Release
Caddy is being updated often. You can find the latest release candidate in the official Caddy git repo. To check the current version of Caddy, you can run
$ caddy version. The below use the Caddy 2.20 rc.1 as an example. Feel free to change it if another version is available for your platform.
$ wget https://github.com/caddyserver/caddy/releases/download/v2.2.0-rc.1/caddy_2.2.0-rc.1_linux_arm64.tar.gz $ tar zxvf caddy_2.2.0-rc.1_linux_arm64.tar.gz $ rm caddy_2.2.0-rc.1_linux_arm64.tar.gz | rm LICENSE | rm README.md $ sudo mv caddy /usr/bin/
Update Caddy and Restart It
It is very straightforward to install the updated Caddy. Just run
$ sudo mv caddy /usr/bin/ $ sudo systemctl start caddy $ caddy version
If you see the new version is working and your web server is back online, congratulations! You’ve updated caddy to the latest version.
Hopefully this Caddy update guide is very simple to follow. Any questions? Feel free to leave a comment below.