Can't access minecraft server through caddy

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:

N/A

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

}

3. The problem I’m having:

I cant access the second subdomain. Idk if I’m missing something again. I posted earlier but it only fixed the first issue I had where I didn’t add spaces after the domains

4. Error messages and/or full log output:

Nov 20 02:36:16 Ubuntu systemd[1]: Started Caddy.
Nov 20 02:36:17 Ubuntu caddy[21711]: caddy.HomeDir=/var/lib/caddy
Nov 20 02:36:17 Ubuntu caddy[21711]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Nov 20 02:36:17 Ubuntu caddy[21711]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Nov 20 02:36:17 Ubuntu caddy[21711]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Nov 20 02:36:17 Ubuntu caddy[21711]: caddy.Version=v2.2.1
Nov 20 02:36:17 Ubuntu caddy[21711]: runtime.GOOS=linux
Nov 20 02:36:17 Ubuntu caddy[21711]: runtime.GOARCH=amd64
Nov 20 02:36:17 Ubuntu caddy[21711]: runtime.Compiler=gc
Nov 20 02:36:17 Ubuntu caddy[21711]: runtime.NumCPU=6
Nov 20 02:36:17 Ubuntu caddy[21711]: runtime.GOMAXPROCS=6
Nov 20 02:36:17 Ubuntu caddy[21711]: runtime.Version=go1.15.2
Nov 20 02:36:17 Ubuntu caddy[21711]: os.Getwd=/
Nov 20 02:36:17 Ubuntu caddy[21711]: LANG=C
Nov 20 02:36:17 Ubuntu caddy[21711]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Nov 20 02:36:17 Ubuntu caddy[21711]: HOME=/var/lib/caddy
Nov 20 02:36:17 Ubuntu caddy[21711]: LOGNAME=caddy
Nov 20 02:36:17 Ubuntu caddy[21711]: USER=caddy
Nov 20 02:36:17 Ubuntu caddy[21711]: INVOCATION_ID=d72540dfcc9846ffb8025b57f1df7513
Nov 20 02:36:17 Ubuntu caddy[21711]: JOURNAL_STREAM=9:25533966
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.03498,“msg”:“using provided configuration”,“config_file”:"/etc/caddy/Caddyfile",“config_adapter”:""}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.036916,“logger”:“admin”,“msg”:“admin endpoint started”,“address”:“tcp/localhost:2019”,“enforce_origin”:false,“origins”:[“localhost:2019”,"[::1]:2019",“127.0.0.1:2019”]}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.0371943,“logger”:“http”,“msg”:“server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS”,“server_name”:“srv0”,“https_port”:443}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.0372243,“logger”:“http”,“msg”:“enabling automatic HTTP->HTTPS redirects”,“server_name”:“srv0”}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.037267,“logger”:“tls.cache.maintenance”,“msg”:“started background certificate maintenance”,“cache”:“0xc0003b0a10”}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.0378041,“logger”:“http”,“msg”:“enabling automatic TLS certificate management”,“domains”:[“jellyfin.scserver.us”,“mc.scserver.us”]}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.1334257,“logger”:“tls”,“msg”:“cleaned up storage units”}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.1495264,“msg”:“autosaved config”,“file”:"/var/lib/caddy/.config/caddy/autosave.json"}
Nov 20 02:36:17 Ubuntu caddy[21711]: {“level”:“info”,“ts”:1605839777.1495442,“msg”:“serving initial configuration”}

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. I also fixed the issue with the space after the domain name

6. Links to relevant resources:

Minecraft is not an HTTP server, it’s a TCP server (as far as I know). So you won’t be able to use vanilla Caddy to proxy to it.

You’d need to use caddy-l4 which does support proxying TCP:

But I doubt that Minecraft supports TLS over TCP, so I don’t think this is what you’re looking for.

Oh, okay. Thanks for that info. Sorry to be a bother haha. I’ll figure it out eventually

What you should do is create an SRV record in your DNS for your domain. Make jellyfin.scserver.us and mc.scserver.us point to your server’s IPv4 address. Then create an SRV record with these details
Service: _minecraft
Protocol: _tcp
Priority: 0
Weight: 5
Port: <the port that your Minecraft server is listening on, default is 25565)
Target:
TTL: Automatic
(Taken from Namecheap)

It looks like you’re using Pterodactyl as your panel so the ports should be firewalled automatically for you. Do those changes, delete those things from the Caddyfile (note that you can also host a webserver with it if you wanted to, just make sure its on ports 80 / 443) and you should be good to go.

2 Likes

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