Caddy2安装:
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 –v #检查是否安装成功
Caddy2管理:
# 启动Caddy2 systemctl start caddy # 开机自启 systemctl enable caddy # 重启Caddy2 systemctl restart caddy # 停止Caddy2 systemctl stop caddy # 重载配置Caddy配置文件(修改配置文件后执行) systemctl reload caddy # 查看Caddy2运行状态 systemctl status caddy
Caddy2简单配置文件:
nano /etc/caddy/Caddyfile #编辑文件
zrblog.net {
redir https://www.zrblog.net{uri} permanent
}
www.zrblog.net {
reverse_proxy *.*.*.*:80
tls {
protocols tls1.2 tls1.3
}
header {
Permissions-Policy interest-cohort=()
Strict-Transport-Security max-age=31536000;
X-Content-Type-Options nosniff
X-Frame-Options DENY
Referrer-Policy no-referrer-when-downgrade
-Via
-Alt-Svc
}
log {
output file /var/log/caddy/zrblog.net.log {
roll_size 10mb
roll_keep 5
}
}
}








![[黑五]RackNerd:便宜VPS年付10美元起,洛杉矶/圣何塞/西雅图等多机房,支持自助换IP-赵容部落](https://www.zrblog.net/wp-content/uploads/2019/12/racknerd.jpg)

![[黑五]HostDare低至3.5折+双倍内存+双倍流量,洛杉矶VPS年付9.1美元起,可选AMD EPYC,可选CN2 GIA+AS9929+CMIN2线路-赵容部落](https://www.zrblog.net/wp-content/uploads/2016/06/hostdare.png)
![[黑五]CloudCone:SSD缓存VPS年付9.99美元起,SSD硬盘VPS年付12.99美元起,洛杉矶&雷斯顿&圣路易斯机房-赵容部落](https://www.zrblog.net/wp-content/uploads/2017/08/cloudcone.png)