1. Caddy version (caddy version
):
2.0.0
2. How I run Caddy:
a. System environment:
AWS EC2 T2 Micro, Amazon Linux 2, Docker 19.03
b. Command:
docker build -t caddy .
docker run --name caddyserver -v $PWD/Caddyfile:/etc/caddy/Caddyfile -v $PWD/caddy.json:/etc/caddy/caddy.json -p 80:80 -p 443:443 -p 2020:2020 --rm caddy
c. Service/unit/compose file:
FROM caddy:2-alpine
RUN apk --no-cache add curl
EXPOSE 80 443 2020
d. My complete Caddyfile or JSON config:
{
debug
acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
admin localhost:2020
}
centige.site {
redir https://centige.com permanent
}
test.centige.site {
reverse_proxy https://xxxx.s3.amazonaws.com
rewrite * https://xxxx.s3.amazonaws.com/{uri}
}
3. The problem I’m having:
I would like to remotely configure my Caddy server using something like api.centige.site
.
I tried adding the following block, but it didn’t solve my problem:
api.centige.site {
reverse_proxy localhost:2020
}
Then I tried setting the admin endpoint to api.centige.site:2020
, but running Caddy failed.
The port 2020
is already exposed in my AWS EC2 security group.
I am not sure if what I’m doing is possible. If it is, I’d really appreciate it if I can get any sort of help : )
4. Error messages and/or full log output:
Connecting to api.centige.site:2020
or EC2_IP:2020
in Insomnia resulted in Error: Couldn't connect to server
.
Using curl
returns connection refused
.
5. What I already tried:
oops, I already described this in 3)
6. Links to relevant resources:
A similar implementation to what I’m trying to do is GitHub Pages. They used to run on Nginx and reload the config every 30 min (Rearchitecting GitHub Pages | The GitHub Blog). I’d like to do the same thing, except, instead of reloading the config using a cron job, I can update it remotely.
PS. thank you for the awesome work