安装Caddy,这里用的是v1老版本

wget -N --no-check-certificate  https://raw.githubusercontent.com/thhbdd/caddy-v1/master/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh

卸载Caddy

wget -N --no-check-certificate https://raw.githubusercontent.com/thhbdd/caddy-v1/master/caddy_install.sh && bash caddy_install.sh uninstall

Caddy 使用命令:/usr/local/caddy/Caddyfile
日志文件:cat /tmp/caddy.log
使用说明:service caddy start | stop | restart | status
或者使用:/etc/init.d/caddy start | stop | restart | status
安装目录:/usr/local/caddyCaddy
自动申请SSL证书位置:/.caddy/acme/acme-v01.api.letsencrypt.org/sites/xxx.xxx(域名)/

以反代谷歌为例:

echo "https://gg.xxx.com {          
root /usr/local/caddy/www/      
tls qq@qq.com               
gzip 
proxy / https://www.google.com.hk             
}" > /usr/local/caddy/Caddyfile

service caddy restart

注:加密码的话可以在邮箱下面一行加上basicauth / user passwd (user和passwd是你的用户名和密码)

Last modification:March 18, 2024
If you think my article is useful to you, please feel free to appreciate