# Caddy

## Structure

```
.
├── caddy (80 | 443)
	└── Caddyfile
```

### Caddy / xcaddy


```bash
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl

# caddy
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
# xcaddy
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list

sudo apt update && sudo apt install -y caddy xcaddy
```

#### Build with dns-ovh

```
[https://go.dev/dl/](https://go.dev/dl/)
```

```bash
wget https://go.dev/dl/go1.26.4.linux-arm64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.26.4.linux-arm64.tar.gz
export PATH=$PATH:/usr/local/go/bin
```

```bash
mkdir ~/caddy && cd caddy

xcaddy build --with github.com/caddy-dns/ovh \
             --with github.com/mholt/caddy-l4/modules/l4proxy \
             --with github.com/mholt/caddy-l4/modules/l4tls \
             --with github.com/mholt/caddy-l4/modules/l4proxyprotocol

sudo mv caddy /usr/bin
sudo chown root:root /usr/bin/caddy
sudo chmod 755 /usr/bin/caddy
sudo systemctl daemon-reload
```

```bash
sudo vim /etc/caddy/Caddyfile
```

> [[Caddyfile]]

```bash
sudo systemctl restart caddy
```
