文章来自:http://blog.csdn.net/intbird 转载请说明出处
目录
1. install Caddy
Centos/redhat 8
sudo dnf -y install ‘dnf-command(copr)’
sudo dnf -y copr enable @caddy/caddy
sudo dnf -y install caddy
Centos/redhat 7
dnf install ‘dnf-command(copr)’
dnf copr enable @caddy/caddy
dnf install caddy
Debian
apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | tee /etc/apt/trusted.gpg.d/caddy-stable.asc
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
apt update
apt install caddy
2.start caddy
service or systemctl
使用默认的 /etc/caddy/Caddyfile
service v2ray start
systemctl restart caddy
reload config
指定Caddyfile路径 $caddy_file
caddy run --config $caddy_file
caddy reload --config $filepath
WorkDirectory
WorkDirectory为当前目录时可以省略path
cd $caddy_file 目录
cd caddyfiles/
caddy start // or caddy run
3. Caddyfile
docs
https://caddyserver.com/docs/caddyfile
https://caddyserver.com/docs/command-line
caddyapi
curl localhost:2019/load \
-X POST \
-H "Content-Type: application/json" \
-d @- << EOF
{
"apps": {
"http": {
"servers": {
"hello": {
"listen": [":2015"],
"routes": [
{
"handle": [{
"handler": "static_response",
"body": "Hello, world!"
}]
}
]
}
}
}
}
}
caddyfile
caddy adapt --config Caddyfile
cloudflare
module:
https://github.com/caddy-dns/cloudflare
custom caddy with cloudflare
https:/