Using the Caddy web server with Laravel is quite easy and straightforward (at least, way more than using Nginx and CertBot). I initially installed it using this and this tutorial, but I didn't like it as the configuration was too complex and cumbersome.

Let's show how easy it can be to get it up and running with Caddy instead, so that we don't have to care about the renewal of certificates or complex configuration files.

First of all, we're running Ubuntu here.

I first stopped and disabled Nginx:

$ sudo systemctl stop nginx
$ sudo systemctl stop certbot
$ sudo systemctl stop certbot.timer

Let's first install Caddy itself:

$ sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
$ curl -1sLf '' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
$ curl -1sLf '' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
$ sudo apt update
$ sudo apt install caddy

Next up is to edit the /etc/caddy/Caddyfile, adding the website:, {
        root * /var/www/
        encode zstd gzip
        php_fastcgi unix//var/run/php/php8.0-fpm.sock

Once that is done, all that is left to do is to restart Caddy:

$ sudo systemctl restart caddy

You can check if it's up-and-running like this:

$ sudo systemctl status caddy

That's it, it's as easy as that. All the rest is done automatically.

You can automate it slightly more by using snippets as explained here.

Related Posts

  • Laravel Service Provider in Simple English
  • How to get request parameters in Laravel
  • Customising lazy-loading prevention in Laravel
  • The giveConfig function in Laravel
  • Optimising large whereIn queries in Laravel