How To Install Caddy on Debian 11

Install Caddy on Debian 11

In this tutorial, we will show you how to install Caddy on Debian 11. For those of you who didn’t know, Caddy is a powerful, enterprise-ready, open-source web server with automatic HTTPS written in Go. It is designed with security in mind and provides a number of features that are useful for hosting websites. Caddy is compatible with Operating Systems such as Linux, BSD, Windows, Mac, Solaris, and Android platforms.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Caddy Web Server on a Debian 11 (Bullseye).


  • A server running one of the following operating systems: Debian 11 (Bullseye).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Caddy on Debian 11 Bullseye

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install curl debian-keyring debian-archive-keyring apt-transport-https

Step 2. Installing Caddy on Debian 11.

By default, the Caddy package is not available on the Debian 11 base repository. Now run the following command to add the Caddy repository to your Debian system:

curl -1sLf '' | tee /etc/apt/sources.list.d/caddy-stable.list

Next, import the GPG key:

curl -1sLf '' | apt-key add -

Now, update the Debian package lists and install Caddy by running the command below:

sudo apt update 
sudo apt install caddy

Then, run the commands below to stop, start and enable the Caddy service to always start up with the server boots:

sudo systemctl stop caddy
sudo systemctl start caddy
sudo systemctl enable caddy

Verify the Caddy installation using the following command:

caddy version

Step 3. Enable PHP Support on Caddy.

Now we install PHP and other necessary extensions using the following command below:

sudo apt install php-fpm php-mysql php-curl php-gd php-mbstring php-common php-xml php-xmlrpc

Next, edit the PHP-FPM configuration file and change the default user and group with caddy:

nano /etc/php/7.4/fpm/pool.d/www.conf

Find and replace:

user = caddy
group = caddy
listen.owner = caddy = caddy

Save and close the file, then restart the PHP-FPM service to apply the changes:

sudo systemctl restart php7.4-fpm

Step 4. Create Virtual Host Caddy.

Now edit the /etc/caddy/Caddyfile file with the following command below:

nano /etc/caddy/Caddyfile

Add the following line: {
    root * /usr/share/caddy/
    encode gzip zstd
    php_fastcgi unix//run/php/php7.4-fpm.sock

Save and close the file, then restart the Caddy service to apply the changes:

sudo systemctl restart caddy

Step 5. Accessing Caddy Web Interface.

Once successfully installed, open your browser and search for your server IP or domain name:

Congratulations! You have successfully installed Caddy. Thanks for using this tutorial for installing the latest version of Caddy  Web Server on Debian 11 Bullseye. For additional help or useful information, we recommend you check the official Caddy website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button