Caddy
Caddy is a fast, dependency free web server and reverse proxy written in Go.
By default Caddy automatically obtains and renews TLS certificates for all your sites. This allows you to focus on what matters and not the annoying process of applying and renewing security certificates.
I am sure you think one certificate for your one URL isn't that bad but with multiple domains and subdomains that task starts to add up.
The Configs
HTTP Server
If all you want is a simple web server to run your static site, you need very little config. The following is my config for this very site.
Caddyfile
parilia.dev {
# Sets the root path for your website
root * /var/www/website/_site
# Compression - To save bandwidth
encode zstd gzip
# Sets the type of server, hides the .git directory from the web
file_server {
hide .git
}
# Rewrites the request URI to hide the .html from the URL
try_files {path}.html
}
Now my config is a little more than the bare minimum and I have added comments to show you what it all does.
Reverse Proxy
This is an even easier setup...
Caddyfile
git.parilia.dev {
reverse_proxy :3456
}
Also when working in Docker containers it can use the app name such as:
Caddyfile
hub.some-site.xyz {
reverse_proxy flarum:8888
}
In Conclusion
The reason that I choose Caddy over the others is ease of use, its simple by comparison configs and the automatic TLS certifications.
I found the others such a NGINX and Apache to feel cumbersome for my needs. They are still very powerful and capable however in my opinion they feel when configuring them to be archaic and overly complex.