需要先创建 Caddyfile 这个是一个文件并不是目录
mkdir /etc/caddy&&
echo "">/etc/caddy/Caddyfile
docker run -d \
--name=caddy \
-v /etc/caddy/Caddyfile:/etc/Caddyfile \
-v /etc/caddy/certs:/root/.caddy \
-p 80:80 -p 443:443 \
-e ACME_AGREE=true \
abiosoft/caddy
caddy2 dockerCompose
version: '2'
services:
caddy:
image: caddy
restart: on-failure
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- "/etc/caddy/data:/data"
- "/etc/caddy/Caddyfile:/etc/caddy/Caddyfile"
- "/etc/caddy/config:/config"
networks:
- default
networks:
default:
external:
name: public
万金油配置
farer.org, www.farer.org {
encode gzip
tls your_email@example.com
reverse_proxy http://ghost_blog_host:2368 {
header_up Host {http.reverse_proxy.upstream.hostport}
header_up X-Real-IP {http.request.remote}
header_up X-Forwarded-For {http.request.remote}
header_up X-Forwarded-Port {http.request.port}
header_up X-Forwarded-Proto {http.request.scheme}
}
}