sword

Caddy一键安装脚本——跨平台支持的极简 HTTP Server (自动申请HTTPS证书)
前言Caddy是一个HTTP server,可以非常简单的安装(Go语言编写,二进制单文件),配置文件也很简单,同...
扫描右侧二维码阅读全文
14
2018/07

Caddy一键安装脚本——跨平台支持的极简 HTTP Server (自动申请HTTPS证书)

前言

Caddy是一个HTTP server,可以非常简单的安装(Go语言编写,二进制单文件),配置文件也很简单,同时还有一些有趣的扩展,可以非常方便的搭建一个HTTP服务

脚本系统要求

CentOS 6+ / Debian 6+ / Ubuntu 14.04 +
推荐 Debian 7 x64

安装步骤

执行下面的代码安装 Caddy

wget -N --no-check-certificate https://softs.loan/Bash/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh

如果上面这个脚本无法下载,尝试使用备用下载:

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

如果想要安装其他扩展可以把名字加到命令后面,例如安装扩展:http.filemanager、http.git、http.filter

那么就是: bash caddy_install.sh install http.filemanager,http.git,http.filter (扩展之间英文半角逗号分割)
例如要安装filemanager扩展(在线文件管理器/私人网盘),则代码如下:

wget -N --no-check-certificate https://softs.loan/Bash/caddy_install.sh && chmod +x caddy_install.sh && bash caddy_install.sh install http.filemanager

扩展列表https://caddyserver.com/download

使用说明

安装完成后在/usr/local/caddy/目录下新建文件名为Caddyfile的配置文件,并写入配置

启动:/etc/init.d/caddy start

停止:/etc/init.d/caddy stop

重启:/etc/init.d/caddy restart

查看状态:/etc/init.d/caddy status

查看Caddy启动日志: tail -f /tmp/caddy.log

安装目录:/usr/local/caddy

Caddy配置文件位置:/usr/local/caddy/Caddyfile

Caddy自动申请SSL证书位置:/.caddy/acme/acme-v01.api.letsencrypt.org/sites/xxx.xxx(域名)/

升级Caddy或者更新扩展

只需要重新执行你当初安装时候用的命令即可,会覆盖安装最新的Caddy+扩展(如有)

卸载Caddy

卸载不会删除虚拟主机的内容,只会删除Caddy自身和配置文件。

wget -N --no-check-certificate https://softs.loan/Bash/caddy_install.sh && bash caddy_install.sh uninstall

如果上面这个脚本无法下载,尝试使用备用下载:

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/caddy_install.sh && bash caddy_install.sh uninstall

原文地址:https://doub.io/shell-jc1/

Last modification:August 19th, 2018 at 04:28 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment

2 comments

  1. shadowsockR与V2ray的使用方法 | gt4404gb的博客   ( Other System Other System / Other Browser Other Browser )

    [...]Caddy一键安装脚本——跨平台支持的极简 HTTP Server (自动申请HTTPS证书)[...]

  2. 呵呵哒   ( Windows 7 x64 Edition Windows 7 x64 Edition / Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 )

    配置挺简单,而且可以自动申请https证书,自动续签