Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

Using Caddy as a Reverse Proxy for Self-Hosted Apps

Learn how to use Caddy as a reverse proxy for your self-hosted apps, with automatic HTTPS, a simple config, and step-by-step VPS setup instructions.

Using Caddy as a Reverse Proxy for Self-Hosted Apps

In the world of self-hosting, Caddy has gained significant attention as a flexible and powerful web server that simplifies the setup of applications while providing features like automatic HTTPS. In this guide, weโ€™ll walk through how to use Caddy as a reverse proxy for your self-hosted applications on a Virtual Private Server (VPS). By the end, youโ€™ll have a clear understanding of how to configure Caddy, what advantages it offers, and how it fits into the broader self-hosting ecosystem.

What is a Reverse Proxy?

A reverse proxy serves as an intermediary for requests from clients seeking resources from servers. It takes client requests, forwards them to the designated server, and then returns the serverโ€™s response to the client. Using a reverse proxy like Caddy can help centralize your self-hosted apps, enhance security, and manage traffic effectively.

Why Choose Caddy?

Caddy offers various advantages for developers and homelabbers:

  1. Automatic HTTPS: Caddy automatically obtains and renews SSL/TLS certificates, which greatly simplifies securing your applications.
  2. Easy Configuration: Caddy uses a simple configuration file (Caddyfile) that makes it straightforward to set up new routes or services.
  3. Performance: Built on Go, Caddy is designed for high performance and scalability.
  4. Extensibility: Caddy supports modules, enabling customization and the addition of features as needed.

Setting Up Caddy as a Reverse Proxy on Your VPS

Prerequisites

Step 1: Choose Your VPS Provider

Before diving into Caddy, youโ€™ll need a reliable VPS provider. Hereโ€™s a comparison of some top choices ideal for self-hosting:

ProviderPrice (Monthly)Features
Contabo VPS5.99 EURUp to 8 GB RAM, high storage, good value
Hetzner Cloud4.15 EURScalable, great performance
DigitalOcean6 USDUser-friendly interface, global data centers
Vultr6 USDSSD storage, low latency
Linode (Akamai)5 USDFast, reliable with excellent support

For detailed comparisons, please visit the full VPS comparison.

Step 2: Install Caddy

You can install Caddy easily using a package manager or by downloading the binary directly. Hereโ€™s how to do it using a package manager on Ubuntu:

sudo apt update
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
echo "deb [signed-by=/usr/share/keyrings/caddy.gpg] https://dl.cloudsmith.io/public/caddy/stable/debian/ any main" | sudo tee /etc/apt/sources.list.d/caddy.list
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor --yes -o /usr/share/keyrings/caddy.gpg
sudo apt update
sudo apt install -y caddy

Step 3: Configure Caddy

Create a Caddyfile to configure the reverse proxy. Hereโ€™s an example setup for a self-hosted application like Nextcloud and a local instance of Grafana:

yourdomain.com {
    reverse_proxy /nextcloud/* localhost:8080
    reverse_proxy /grafana/* localhost:3000
    log {
        output file /var/log/caddy/access.log
    }
}

In this configuration, requests to yourdomain.com/nextcloud will be proxied to the Nextcloud service running on localhost at port 8080, while Grafana will use port 3000.

Step 4: Start Caddy

After configuring the Caddyfile, you can start the Caddy service:

sudo systemctl start caddy
sudo systemctl enable caddy

Step 5: Verify Your Setup

Open your web browser and visit https://yourdomain.com/nextcloud and https://yourdomain.com/grafana. You should see your self-hosted applications, now accessible through the Caddy reverse proxy.

FAQs

How does Caddy simplify HTTPS management?

Caddy automatically obtains SSL certificates from Letโ€™s Encrypt. This means that as soon as you point your domain to your VPS and configure your Caddyfile, Caddy will handle the entire process of obtaining and renewing these certificates. This reduces the complexity of managing security, allowing you to focus on deploying and maintaining your applications.

Can I run multiple applications with Caddy?

Absolutely! Caddy is designed to handle multiple applications seamlessly. You can configure different routes in your Caddyfile, pointing each to its respective application running on different ports or domains. This makes it an excellent choice for developers looking to consolidate multiple services under a single domain.

Is Caddy a good choice for production use?

Yes, Caddy is suitable for production environments. Many developers appreciate its production-ready features, including automatic HTTPS, a straightforward configuration, and high performance under load. Itโ€™s a viable option for self-hosted services, particularly when you want to keep the overhead low while ensuring that your applications are secure and efficiently managed.

Conclusion

Using Caddy as a reverse proxy on your VPS is a robust solution for managing self-hosted applications. With its automatic HTTPS, simple configuration, and excellent performance, Caddy simplifies the complexities of running multiple services. Whether you are hosting Nextcloud, Grafana, or any other open-source apps, leveraging Caddy can enhance your self-hosting experience while keeping it secure and streamlined. For more information on selecting the right VPS for your needs, check out our full VPS comparison.