jezahost
· updated November 27, 2026
  • ssl
  • lets-encrypt
  • caddy
  • nginx
  • proxy

One IP, one port 443, dozens of systems: automatic wildcard SSL with Caddy and Nginx Proxy Manager

Running all your internal and external systems over HTTPS with one static IP and one port 443: wildcard certificates with Caddy and Nginx Proxy Manager, and their automatic renewal.

In many companies the picture looks roughly like this: the Proxmox panel is on port 8006, the firewall on 8443, monitoring on 9443 and the camera system on 10443. Each has its own self-signed certificate, and the browser says "Not secure" every time. The reason is the same everywhere: "We have one static IP, and port 443 is already taken".

In fact, one IP and one port 443 are enough for dozens of systems. In this post we will show how to set it up.

In the previous post we obtained a free wildcard certificate by hand with DNS-01 validation. One problem remained there: when the certificate was renewed, everything had to be done again. Today we automate that work completely.

How does one port serve several systems?

When a browser connects to a site, it tells the server not only the IP and port but also which address it wants to open. For example: "I want panel.sirket.az".

So a single program can sit on port 443. It looks at the address of the incoming request and passes it on to the right system:

                          ┌─→ panel.sirket.az     → 10.0.0.10:8006 (Proxmox)
internet / office → :443 ─┼─→ fw.sirket.az        → 10.0.0.1:8443  (firewall)
   (reverse proxy)        ├─→ grafana.sirket.az   → 10.0.0.20:3000 (monitoring)
                          └─→ api.menim.sirket.az → 10.0.0.30:8080 (app)

This program is called a reverse proxy. The SSL certificate is kept on it too. None of the systems behind it need a certificate installed.

The two most convenient options are:

  • Caddy: the configuration is a text file a few lines long;
  • Nginx Proxy Manager (NPM): everything is done in a web interface, with clicks.

All levels in one go

There is one thing about wildcard certificates that many people don't know: *.sirket.az covers only one level. That is, it works for panel.sirket.az, but not for api.menim.sirket.az.

The solution is simple: you list several wildcards in the request and get them all at once:

*.sirket.az
*.menim.sirket.az
*.api.menim.sirket.az

After that, any new subdomain on these levels opens over HTTPS right away. No new certificate is needed.

What you need

  • a Linux server with Docker installed (a virtual machine on the internal network works too);
  • the ability to manage the domain's DNS through an API.

The second point matters. For automation the proxy has to write the TXT record to DNS itself, and for that it needs the DNS provider's API. Many local registrars (hosting companies) have no API. In that case the simplest way is to move the domain's DNS management to Cloudflare (it is free). The domain stays with your registrar, only the NS records change.

In Cloudflare go to My Profile → API Tokens → Create Token and choose the "Edit zone DNS" template. Grant permission for one domain only. This token can change only that domain's DNS, nothing else.

Option 1: Nginx Proxy Manager

Everything in NPM is set up in the browser panel. The code is needed only once, to install the program on the server.

docker-compose.yml:

services:
  npm:
    image: jc21/nginx-proxy-manager:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "127.0.0.1:81:81"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
docker compose up -d

Port 81 is the admin panel and opens only from the server itself. Reach the panel through an SSH tunnel:

ssh -L 8181:127.0.0.1:81 istifadeci@server

On Windows you can open the tunnel without typing a command: in PuTTY go to Connection → SSH → Tunnels, enter Source port 8181 and Destination 127.0.0.1:81, press Add and connect to the server.

Then open http://127.0.0.1:8181 in the browser. On first login you will be asked to create a new account or change the default password. Do it right away.

Certificate: go to SSL Certificates → Add SSL Certificate → Let's Encrypt.

  1. In the Domain Names field enter three lines: *.sirket.az, *.menim.sirket.az, *.api.menim.sirket.az.
  2. Turn on Use a DNS Challenge.
  3. Choose Cloudflare from the DNS Provider list.
  4. In the Credentials File Content field replace the sample value with your token: `` dns_cloudflare_api_token = sizin-tokeniniz ``
  5. Click Save.

A minute or two later the certificate is ready. NPM renews it on its own before it expires.

Adding systems: go to Hosts → Proxy Hosts → Add Proxy Host.

  • Domain Names: panel.sirket.az;
  • Scheme / Forward Hostname / Port: https, 10.0.0.10, 8006;
  • Websockets Support: turn on (needed for the Proxmox console);
  • SSL tab: choose the wildcard certificate, turn on Force SSL.

Each new system is a one-minute job: a new proxy host, an address, an internal IP and a port. The certificate is already there.

Access without a tunnel: you can add the panel itself as a proxy host. Domain Names npm.sirket.az, Scheme http, Forward Hostname 127.0.0.1, Port 81, and the wildcard certificate in the SSL tab. Then create a list in Access Lists that allows only your own IP address and attach it to this proxy host. From then on the panel opens in the browser like an ordinary site, and the tunnel is no longer needed.

Option 2: Caddy

Caddy's standard Docker image does not include DNS provider modules. So we build a small image with the Cloudflare module. Dockerfile:

FROM caddy:2-builder AS builder
RUN xcaddy build --with github.com/caddy-dns/cloudflare

FROM caddy:2
COPY --from=builder /usr/bin/caddy /usr/bin/caddy

docker-compose.yml:

services:
  caddy:
    build: .
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    environment:
      - CF_API_TOKEN=${CF_API_TOKEN}
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data

volumes:
  caddy_data:

Put the token in a .env file in the same folder:

CF_API_TOKEN=sizin-tokeniniz

Caddyfile:

{
	acme_dns cloudflare {env.CF_API_TOKEN}
}

*.sirket.az, *.menim.sirket.az, *.api.menim.sirket.az {
	@panel host panel.sirket.az
	handle @panel {
		reverse_proxy https://10.0.0.10:8006 {
			transport http {
				tls_insecure_skip_verify
			}
		}
	}

	@grafana host grafana.sirket.az
	handle @grafana {
		reverse_proxy 10.0.0.20:3000
	}

	@api host api.menim.sirket.az
	handle @api {
		reverse_proxy 10.0.0.30:8080
	}

	handle {
		abort
	}
}
docker compose up -d --build

Caddy obtains the wildcard certificates itself, renews them itself and needs no extra command for it. To add a new system, write three lines in the Caddyfile and run docker compose restart caddy.

The tls_insecure_skip_verify line serves one purpose: systems like Proxmox run internally with their own self-signed certificate, and we tell Caddy not to verify it. On the user's side the certificate is fully trusted. The final handle { abort } block closes requests that arrive with unknown addresses right away.

Internal systems without exposing them to the internet

This is where the real benefit of DNS-01 shows. The proxy does not need to be reachable from the internet to get a certificate. So two scenarios are possible:

Internal use only. The proxy sits on the office network and is not exposed to the internet at all. On your internal DNS server (for example, the domain controller) you point panel.sirket.az to the proxy's internal IP. When staff connect in the office or over VPN, all panels open with a green padlock. From outside, nothing is visible.

Internal and external together. On the router you forward only port 443 to the proxy. Systems that must be public (the site, the API) go into public DNS, while internal systems are kept only in internal DNS. In NPM you can create an Access List for the internal systems and allow only the office network.

In both cases the result is the same: one IP, one port, one set of certificates, and all of it automatic.

Quick security notes

  • Give the API token permission over one domain's DNS only. If the token is stolen, the damage is limited to that domain's DNS records.
  • Never let the token end up in a Git repository. Add the .env file to .gitignore.
  • Don't expose the NPM panel (port 81) to the internet.
  • If you publish admin panels through the proxy, be sure to add access restrictions and two-factor login.

In short

  • One IP and one port 443 are enough for dozens of systems. A reverse proxy does the job.
  • *.sirket.az covers only one level. Get all the levels you need in one go.
  • If your DNS provider has no API, move DNS to Cloudflare for free.
  • NPM works with clicks, Caddy with one text file. Both renew certificates on their own.
  • Thanks to DNS-01, internal systems get trusted certificates without being exposed to the internet.

You set it up once, and after that you only add new systems. The "Not secure" warning becomes history.

At JezaHost, when you attach a domain to a VPS, the SSL certificate is issued automatically and renews itself. If you want to set up your own proxy, both options in this post run on a VPS without any trouble.