VPS one-click scripts

Caddy Reverse Proxy and Automatic HTTPS Tutorial

This tutorial shows how to install Caddy with xyz.sh/caddy and reverse-proxy a domain with automatic HTTPS.

Command
$ curl -fsSL xyz.sh/caddy | bash

Details · xyz.sh/caddy · Last updated:

Prerequisites

Root, systemd, and TCP 80/443 free and open.

A domain pointed at this server (when using --domain).

Steps

Optional: read the source with curl -fsSL xyz.sh/caddy.sh and compare xyz.sh/caddy.sh.sha256.

Install Caddy only: curl -fsSL xyz.sh/caddy | bash -s -- -y

Reverse-proxy local port 8080 for a domain: curl -fsSL xyz.sh/caddy | bash -s -- --domain example.com --to 127.0.0.1:8080 -y

Set an ACME email: add --email me@example.com

Run again with another --domain to add sites; the same domain updates its block.

How to verify

Run systemctl status caddy and caddy version; after adding a domain, https://your-domain should show the backend with a Let's Encrypt or ZeroSSL certificate.

How to undo or uninstall

curl -fsSL xyz.sh/caddy | bash -s -- --uninstall -y stops and removes the caddy service and /usr/bin/caddy; /etc/caddy and certificate data in /var/lib/caddy are kept — delete them manually if needed.