跳转至

部署 Caddy 反向代理工具

Caddy 官方中文文档

官方脚本部署

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
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
sudo apt update
sudo apt install caddy
Caddy 启动、停止、重启、查看状态

启动

sudo systemctl start caddy

停止

sudo systemctl stop caddy

重启

sudo systemctl reload caddy

查看状态

systemctl status caddy

Docker 部署

mkdir -p /srv /etc/caddy
1
2
3
4
5
6
7
8
docker run -d \
    --name caddy \
    -p 80:80 \
    -p 443:443 \
    -v /etc/caddy/Caddyfile:/etc/caddy/Caddyfile \
    -v caddy_data:/data \
    -v caddy_config:/config \
    caddy:latest