[SOLVED] Help with multiple subdomains not loading servers

1. Caddy version (caddy version):

v2.2.1

2. How I run Caddy:

I am running caddy as a reverse proxy on a proxmox vm. which houses my docker containers.

a. System environment:

Proxmox virtual environment, caddy is running in a ubuntu vm.

b. Command:

systemctl start caddy

c. Service/unit/compose file:

d. My complete Caddyfile or JSON config:

jellyfin.scserver.us{
reverse_proxy 172.17.0.4:8096

}
mc.scserver.us{
reverse_proxy 172.17.0.5:25567

}

3. The problem I’m having:

if I run caddy without the second subdomain it runs just fine and I can access my jellyfin server from the url. but if i add my minecraft server subdomain it breaks it and i cant find out why.

4. Error messages and/or full log output:

root@Ubuntu:/etc/caddy# systemctl status caddy

  • caddy.service - Caddy
    Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
    Active: active (running) since Fri 2020-11-20 01:45:08 UTC; 15min ago
    Docs: https://caddyserver.com/docs/
    Main PID: 30950 (caddy)
    Tasks: 11 (limit: 4915)
    Memory: 12.0M
    CGroup: /system.slice/caddy.service
    `-30950 /usr/bin/caddy run --environ --config /etc/caddy/Caddyfile

Nov 20 01:45:08 Ubuntu caddy[30950]: INVOCATION_ID=62beac6944094550826781fa4e6c1cf8
Nov 20 01:45:08 Ubuntu caddy[30950]: JOURNAL_STREAM=9:25341879
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.3811297,“msg”:“using provided configuration”,“config_file”:"/etc/caddy/Caddyfile",“config_adapter”:""}
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.3832564,“logger”:“admin”,“msg”:“admin endpoint started”,“address”:“tcp/localhost:2019”,“enforce_origin”:f>
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.3835042,“logger”:“tls.cache.maintenance”,“msg”:“started background certificate maintenance”,“cache”:“0xc0>
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.3835359,“logger”:“http”,“msg”:“server is listening only on the HTTPS port but has no TLS connection polic>
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.383556,“logger”:“http”,“msg”:“enabling automatic HTTP->HTTPS redirects”,“server_name”:“srv0”}
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.3843129,“msg”:“autosaved config”,“file”:”/var/lib/caddy/.config/caddy/autosave.json”}
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.3843331,“msg”:“serving initial configuration”}
Nov 20 01:45:08 Ubuntu caddy[30950]: {“level”:“info”,“ts”:1605836708.385553,“logger”:“tls”,“msg”:“cleaned up storage units”}

5. What I already tried:

I didn’t have the brackets at one point so i fixed that. I have double checked ports on my router. Made sure my domain was pointing to my dynamic dns through duckdns. I have pinged the server and gotten my ip address as well.

6. Links to relevant resources:

Spaces are important in the Caddyfile, you need to add space before the {, otherwise Caddy thinks { is part of your domain.

Also, your logs are truncated (see the > at the end of the lines). I recommend using the command sudo journalctl --no-page -u caddy | less to read your logs (hit Shift+G to jump to the bottom).

Thank you so much!! I feel stupid haha. Its working as intended now!!

1 Like