Caddy for https on non-standard port?

1. The problem I’m having:

I have cloud instance I’m running a navidrome server on.

I do not have bare metal or full access, just a few non-standard ports. As there is no ‘app;’ for navridrome in the admin panel, I’m just running the binary via ssh. The address is of the format:

blah.blah.blah.blah:45678

this allows me to connect http via web browser/app etc, but I would like https

I’m to this stuff, and new to caddy, have never attempted to get https working before

2. Error messages and/or full log output:

PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.

c. Service/unit/compose file:


d. My complete Caddy config:

just the url of the domain

5. Links to relevant resources:

When you write your config (I assume you’ll use a Caddyfile), just put the port in the site address:

example.com:45678 {
    ...
}

For Caddy to be able to get a certificate without any extra configuration, though, you’ll need to make sure external port 443 forwards to port 45678 internally. (And that port 80 is forwarded as well.)

Alternatively to all this: if you do forward ports 80 and 443 internally, you can specify alternate ports in your global options:

{
    http_port 8080
    https_port 45678
}

or whatever they are.

1 Like

And if you can’t get incoming traffic on ports 80/443 to reach your server, then you can use the ACME DNS challenge to get a certificate. It has no specific port requirements, but you need a build of Caddy with the appropriate DNS plugin for your DNS provider to connect to it so Caddy can write DNS records to prove you control the domain.

2 Likes

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