fjc0k / docker-caddy

Web 服务器 Caddy 2 的 Docker 镜像。

Home Page:https://hub.docker.com/r/jayfong/caddy/tags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-caddy

Web 服务器 Caddy 2 的 Docker 镜像。


特性

与官方镜像 caddyserver/caddy-docker 相比,做了一些符合**用户使用习惯的增强,主要有以下几点:

支持设置时区

你可通过环境变量 TZ 设置时区,若不设置,默认是:Asia/Shanghai

支持 DNSPod

支持使用 DNSPod 作为 DNS 提供者,并内置 dnspod 片段方便导入:

# Caddyfile

www.foo.bar {
  import dnspod

  respond "hello caddy"
}

注意: 使用这项功能之前,你得先通过环境变量 DNSPOD_API_KEY 设置 DNSPod 的鉴权信息,格式是 ID,Token,比如 10086,1b68f307ee4e5adb10od31d4d4v42dla

内置安全相关的 HTTP 响应头

全部安全相关的 HTTP 响应头皆提取自 helmetjs/helmet 的默认设置,你可通过内置的 security 片段导入:

# Caddyfile

www.foo.bar {
  import dnspod
  import security

  respond "hello caddy"
}

支持使用 host.docker.internal 访问宿主服务

# Caddyfile

api.foo.bar {
  import dnspod
  import security

  reverse_proxy host.docker.internal:4000
}

支持通过环境变量 OCSP_IP 设置 ocsp.int-x3.letsencrypt.org 的 IP 地址

具体讨论见「国内 Let's Encrypt 的 OCSP 域名 ocsp.int-x3.letsencrypt.org 的解析被污染了?」,其表现就像这样:

[WARNING] Stapling OCSP: no OCSP stapling for [*.com]: making OCSP request: Post http://ocsp.int-x3.letsencrypt.org: dial tcp 88.191.249.182:80: i/o timeout

因此,本镜像支持通过环境变量 OCSP_IP 设置 ocsp.int-x3.letsencrypt.org 解析去的 IP,当然,这个 IP 内置了一个默认值 23.215.132.184,但其可能会变,如果无法使用,可使用国外的服务器 ping 一下 ocsp.int-x3.letsencrypt.org 获取最新的 IP 后覆盖掉默认值。

推荐一个国外的在线 ping 服务:https://check-host.net/check-ping?host=ocsp.int-x3.letsencrypt.org

许可

Jay Fong (c) MIT

About

Web 服务器 Caddy 2 的 Docker 镜像。

https://hub.docker.com/r/jayfong/caddy/tags

License:MIT License


Languages

Language:Dockerfile 63.9%Language:Shell 27.0%Language:JavaScript 9.1%