使用Debian进行演示
官方安装步骤
apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg
chmod o+r /etc/apt/sources.list.d/caddy-stable.list
apt update
apt install caddy
运行 caddy version,查看是否安装成功
root@:~# caddy version
v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U=
/etc/caddy/Caddyfile
http://uhdnow.uowo.de { # http://uhdnow.uowo.de 为自己的域名,如果需要开启https自己修改,端口也可以修改
# 反向代理到 https://rfc.uhdnow.com
reverse_proxy https://rfc.uhdnow.com {
# `header_up` 用于修改发送到上游服务器的请求头。
header_up Host {upstream_hostport}
}
}
systemctl restart caddy
systemctl status caddy