-
Notifications
You must be signed in to change notification settings - Fork 65
Caddy开启https、反向代理
Ccapton edited this page Nov 8, 2018
·
2 revisions
caddy开启https、反向代理
- 一键安装caddy脚本
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh install http.filemanager
- 一键卸载caddy脚本
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh uninstall
注意: 以下对caddy的操作为覆盖性写入动作,如已经有其他caddy项目,请先备份该配置文件
示例条件:
- 域名(请一定要成功解析到你的服务器)为 mydomain.fun,
- 邮箱为 mydomain@gmail.com
- 运行brook-web的主机ip为 123.123.123.123
- 运行brook-web的端口为 5000
- 默认使用80 端口,443为https端口,即 可通过 http://mydomain.fun 或 https://mydomain.fun 访问
echo "mydomain.fun {
gzip
tls mydomain@gmail.com
proxy / http://123.123.123.123:5000
}" > /usr/local/caddy/Caddyfile
- 假如使用自定义端口,端口为 5001 ,只能通过 https://mydomain.fun:5001 访问 (不会重定向http到https)
echo "mydomain.fun:5001 {
gzip
tls mydomain@gmail.com
proxy / http://123.123.123.123:5000
}" > /usr/local/caddy/Caddyfile
请将以上示例条件,根据你的实际情况进行替换
开启caddy服务
service caddy start
关闭caddy服务
service caddy stop
重启caddy服务
service caddy restart
查看caddy服务状态
service caddy start
查看caddy日志
tail -f /tmp/caddy.log