安装Caddy
安装 Caddy
二进制安装包地址 https://github.com/caddyserver/caddy/releases
CentOS
yum install caddy
systemctl enable caddy
systemctl start caddy
Ubuntu
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
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
Docker
# 下载caddy
docker pull caddy:2.6.2
# 安装caddy容器
docker run -itd \
--name my_caddy \
-p 80:80 \
-p 443:443 \
-v /home/caddy/srv:/srv \
-v /home/caddy/data:/data \
-v /home/caddy/config:/config \
caddy:2.6.2
源码构建
要求:
Go 1.16 或更新的版本
克隆仓库源码:
git clone "https://github.com/caddyserver/caddy.git"
构建:
cd caddy/cmd/caddy/
go build