Caddy is a fast and easy web server

Featured image

What is Caddyserver?

Caddyserver is a simple, yet heavily extensible webserver written in Go.

It has been praised by many security experts since it’s open-source and has the most secure default security settings.

When you install Caddyserver, the installation script will download only one binary file and give it the proper permissions. By default this program does not have extensions built-in, but they can easily be added on the website.

Compared to other web servers, Caddyserver has an automation feature to fetch free SSL certificates from Let’s Encrypt, exactly like Certbot does with Nginx and Apache.

Please note that this will not work for domains not exposed to the clearnet, therefore LAN IP addresses and custom DNS configurations cannot get an SSL certificate automatically.

How does it work and what requirements does it have?

It works by making a simple webserver for displaying static content like most webservers. It can also handle PHP in pretty much the same way nginx does, using sockets or by reverse proxying (although Apache supports it natively). It has very little in the way of requirements, it supports all major platforms: Apple, Linux, Windows, BSD, Solaris, Plan 9, NACL and Dragonfly. Since this program is open-source, it is really easy to modify it if you have experience in Go.

Use cases

Feel free to use Caddy for almost all possible uses once can expect from a web server, notably serving static content, testing HTML/js-based applications. Php is also easily configurable provided you have php-fpm installed on the server.


To install Caddyserver for personal use, it is very straightforward:

curl | bash -s personal
Please note that while Caddy is open-source, it doesn’t necessarily mean it's FOSS. Caddy, on the free level, can only be used for non-commercial use, but requires paying for commercial uses. For more information please go to the Official Website

There are a few ways to configure Caddy beyond the defaults you get when you run the command. For example, persay you are trying to test a html application that needs some specifc server side settings and the files are stored at /home/user/projects/html-app/. Make a file in the websites folder named Caddyfile, Caddy will look for this file in the current working directory, and if it exists, use that configuration, or you can specify a different Caddyfile that is somewhere else on your system by using the -conf flag like so, caddy -conf /home/user/caddyfiles/basic and it will load that specific config file. I use this to keep myself from writing the same lines of code over and over and just have specific config files for each of these tasks.

Perhaps you want to have a universal configuration for php that you can import to save you time, for example. Make the file with the php caddy config, /home/user/caddyfiles/php and add this to the appropriete location in your original Caddyfile import /home/user/caddyfiles/php

DISCLAIMER: You must manually make these configurations yourself

Example Caddyfile.

:80 {
  root ./
  index index.html
  log     ./Caddylog
  errors  ./Caddyerr


Now that we have discussed the pros of Caddyserver, we can talk Cons. A lot of forums and prebuilt PHP applications utilize a .htaccess file. Caddy does not currently support these files so you will have to rewrite this file by hand into your caddyfile. Documentation for this is available. And unfortunately, when you run this as a service like you would a normal web server, its error log files have to be added and made by hand in the caddyfile. And you need the plugin hook.service in order to easily use it as an actual service and get SSL certificates. Along with the fact that service caddy status and systemctl status caddy don’t actually show what caddy is doing and instead you have to look in journalctl -xe to see what errors it is spewing at the time being. Usually, these errors are as simple as misplacing/forgetting to add a line somewhere in the config

Written by Merith