Custom SSL certificates

Traefik normally obtains HTTPS certificates through the letsencrypt certificate resolver. Use a custom certificate when a private certificate authority, an organization-managed certificate, or another certificate workflow must terminate TLS at Traefik.

The certificate and private key must exist on every server whose Traefik proxy serves the domain.

Prepare the certificate files

You need:

  • a PEM-encoded certificate file that includes any required intermediate certificates
  • the matching unencrypted private key
  • shell access to the server running the resource
Protect the private key

Copy the key over an encrypted connection, restrict its permissions, and never commit it to a repository or paste it into the Coolify dashboard.

On the resource server, create the certificate directory:

sudo install -d -m 700 /data/coolify/proxy/certs

Copy the files from your machine to the resource server. Replace the local paths and server address:

scp /path/to/example.com.crt root@<server-address>:/data/coolify/proxy/certs/example.com.crt
scp /path/to/example.com.key root@<server-address>:/data/coolify/proxy/certs/example.com.key

Restrict access to the private key on the server:

sudo chmod 600 /data/coolify/proxy/certs/example.com.key

Coolify mounts /data/coolify/proxy/ at /traefik/ inside the Traefik container.

Add the dynamic TLS configuration

Open Servers > your server > Proxy > Dynamic Configurations, select Add, and create a file such as custom-certificates.yaml:

tls:
  certificates:
    - certFile: /traefik/certs/example.com.crt
      keyFile: /traefik/certs/example.com.key

Save the file. Traefik watches the dynamic configuration directory and selects a matching certificate from the certificate's subject alternative names when a request arrives.

Renew a custom certificate

Stage the renewed certificate chain and its matching private key under new filenames. Update the watched dynamic TLS YAML once so that certFile and keyFile both point to the staged pair. If you keep the filenames, replace both files first and then touch the dynamic YAML on the host so Traefik reloads it. Keep the old pair available until verification succeeds. This procedure uses files you manage in the dynamic configuration.

Verify the certificate

Check each origin directly. Replace the example IP with the origin address and send the actual domain as the TLS server name (SNI). Compare the SHA-256 fingerprint and expiry to the renewed certificate:

openssl s_client -connect 192.0.2.10:443 -servername example.com </dev/null 2>/dev/null \
  | openssl x509 -noout -fingerprint -sha256 -dates -ext subjectAltName

If Traefik continues to serve another certificate, confirm that the certificate covers the requested hostname and inspect Servers > your server > Proxy > Logs for file or key parsing errors.

Stop Let's Encrypt requests

With the default settings, Coolify still adds the letsencrypt certificate resolver to the route. Traefik does not request a certificate when a loaded certificate covers all domains of the route, so the custom certificate is used.

To remove the resolver from the routes, set the certificate resolver to None on the resource, or clear it for the whole server. This is necessary if you removed the letsencrypt resolver from the Traefik configuration, or if you use a default certificate (tls.stores.default.defaultCertificate) that does not match the domain.

On this page