Source Code (v2 - Updated)
We believe in radical transparency. Below is the full source code for caddyscript v2.0 (Nov 2025).
It creates sites, manages users, handles backups, and performs clean uninstalls.
caddyscript.sh (14KB)
SHA256: Verification recommended after download.
What the script actually does (high-level)
- Checks you're root + running Debian 13
- Installs Caddy from official repo (auto-HTTPS + HTTP/3)
- Adds Sury PHP 8.3 + FPM with modern extensions
- Installs & secures MariaDB
- Sets up UFW (22,80,443 only), Fail2Ban, unattended-upgrades
- Creates per-site PHP-FPM pool + Caddyfile snippet
- Downloads & configures ClassicPress (or static site)
- Enables security headers, Zstd, immutable caching
- Optionally backs up with --backup tar/rsync
- Full uninstall with --uninstall
Usage: $ caddyscript [--install | --create --domain example.com --type static|classicpress|php | --delete example.com | --uninstall]
Dependencies Installed: caddy, php8.3-fpm, mariadb-server, ufw, zip, curl.
Usage (V2 - Command Line Interface)
Save as `/usr/local/bin/caddyscript`, `chmod +x`, and use like:
$ caddyscript --domain blog.com --type classicpress
$ caddyscript --domain static.com --type static
$ caddyscript --domain staging.blog.com --type staging --staging-source blog.com
$ caddyscript --uninstall # nuclear cleanup