Caddy V2 not accessible from domain name

1. Caddy version (caddy version):

v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=

2. How I run Caddy:

a. System environment:

Ubuntu 18.04.4
Installed via apt.

b. Command:

Caddy is running as a service so I am running:

caddy reload

In the directory where my config is.

d. My complete Caddyfile or JSON config:

{
	debug
	email myemail@provider.com
	acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
}

http://site.com, http://localhost {
	respond "I am server"
}

3. The problem I’m having:

There is no response when attempting to access externally. I.e. going to site.com just hangs.

4. Error messages and/or full log output:

No errors. Running caddy start:

2020/05/09 12:49:07.081	INFO	using adjacent Caddyfile
2020/05/09 12:49:07.081	INFO	admin	admin endpoint started	{"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2020/05/09 12:49:07.081	INFO	tls	cleaned up storage units
2020/05/09 13:49:07 [INFO][cache:0xc00062b770] Started certificate maintenance routine
2020/05/09 12:49:07.081	INFO	autosaved config	{"file": "/home/rhys/.config/caddy/autosave.json"}
2020/05/09 12:49:07.081	INFO	serving initial configuration
Successfully started Caddy (pid=32688) - Caddy is running in the background

And running caddy reload:

2020/05/09 12:49:11.765	INFO	using adjacent Caddyfile
2020/05/09 12:49:11.766	INFO	admin.api	received request	{"method": "POST", "host": "localhost:2019", "uri": "/load", "remote_addr": "127.0.0.1:41018", "headers": {"Accept-Encoding":["gzip"],"Content-Length":["164"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
2020/05/09 12:49:11.766	INFO	admin.api	config is unchanged
2020/05/09 12:49:11.766	INFO	admin.api	load complete

5. What I already tried:

  • Responds correctly on the machine with curl localhost
  • Pinging domain name works, sshing to domain name works, and I have a some nginx docker containers that I can boot up that do respond on port 80/443 of the domain name, so I’m sure the DNS records are configured correctly.
  • Ran sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/caddy so it could run on 80/443 without root.

Solved it. Somehow my docker containers did not need 80/443 allowed in UFW but obviously these are needed for Caddy.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.