DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk10 min

WordPress with Traefik and Docker Compose: Complete HTTPS Setup

A practical, current guide to running WordPress behind Traefik and Docker Compose with automatic HTTPS, persistent ACME storage, TLS-ALPN-01 or HTTP-01 validation, and fixes for 404 and default-certificate errors.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Put Traefik at the edge, keep WordPress on an internal Docker network, and let Traefik obtain and renew the certificate. The working path is: point a public DNS record at the Docker host, publish Traefik on the port required by your ACME challenge, enable the Docker provider with automatic exposure disabled, and add an HTTPS router to the WordPress service.

For a TLS-ALPN-01 challenge, Traefik must be reachable directly on port 443. For HTTP-01, it must be reachable on port 80 (and normally 443 for the finished HTTPS site). Persist acme.json so a recreated container does not lose the certificate account or issued certificates.

As an Amazon Associate I earn from qualifying purchases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How the finished deployment works

A browser requests https://example.com. Public DNS sends that hostname to your server. Traefik is the only container that needs to publish ports to the internet; it terminates TLS, selects the router whose Host rule matches the request, and forwards plain HTTP traffic over Docker’s private network to WordPress on its internal port 80.

The WordPress container does not need to publish port 80 to the host. It only needs to share a Docker network with Traefik. This keeps the application behind the reverse proxy and prevents a second web server from competing for the public ports.

  • Public edge: Traefik listens on :443, and on :80 when you use HTTP-01 or an HTTP-to-HTTPS redirect.
  • Certificate state: Traefik stores ACME data in /letsencrypt/acme.json, backed by a host directory.
  • Routing: Docker labels define the WordPress Host rule, secure entrypoint, TLS mode, resolver, and backend port.
  • Isolation: providers.docker.exposedbydefault=false means a container is not routed unless you explicitly enable it.

Prerequisites: DNS, ports and host access

Use a server that is publicly reachable from the internet. Install Docker and Docker Compose, and make sure your firewall, cloud security group and any upstream router forward the same ports you publish in Compose.

DNS must be correct before ACME validation

Create an A record (and an AAAA record only if IPv6 is configured and reachable) for the exact WordPress hostname, such as example.com, pointing to the server that runs Traefik. Check the record from an external network, not only from the server itself. If DNS points elsewhere, the certificate authority will contact the wrong machine and issuance will fail.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Port requirements by challenge

Challenge Public port that must reach Traefik Traefik setting Best fit
TLS-ALPN-01 443 --certificatesresolvers.myresolver.acme.tlschallenge=true Use when Traefik can receive HTTPS directly and port 443 is available.
HTTP-01 80 (and 443 for the final HTTPS site) --certificatesresolvers.myresolver.acme.httpchallenge=true plus --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web Use when port 80 can reach Traefik and your firewall or load balancer permits the challenge request.

Do not select a challenge based only on which port is open locally. The required port must be reachable from the public internet without another proxy, load balancer or service intercepting the ACME request.

Choose HTTP-01 or TLS-ALPN-01

TLS-ALPN-01

TLS-ALPN-01 validates the hostname through port 443. Traefik temporarily answers the ACME validation handshake on its HTTPS entrypoint, so you do not need to expose port 80 solely for certificate issuance. This is usually the simpler choice when Traefik owns 443 directly.

HTTP-01

HTTP-01 validates a file-like request on port 80. Configure a web entrypoint at :80 and tell the resolver to use it. Publish port 80 even if normal visitors are redirected to HTTPS. A redirect is acceptable only when the ACME challenge path remains reachable; test issuance before tightening redirect rules.

Decision checklist

  • Choose TLS-ALPN-01 when 443 is forwarded straight to Traefik and no upstream device terminates or rewrites TLS first.
  • Choose HTTP-01 when 80 is the reliable path to Traefik or an existing HTTP-facing design makes that route easier to operate.
  • If a load balancer owns either port, confirm that it passes the selected challenge through unchanged. Otherwise, use the challenge that reaches Traefik itself.

Create the persistent directories and network

From a new deployment directory, create a directory for ACME state and a shared Docker network. The network name in the Compose file must be the same for Traefik and WordPress.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mkdir -p letsencrypt
 touch letsencrypt/acme.json
 chmod 600 letsencrypt/acme.json
docker network create traefik_proxy

The file contains the ACME account and certificate data. Back it up securely and do not commit it to source control. Restrict access to the account that runs Docker; anyone who can read or replace it can interfere with certificate management.

Compose file for Traefik

The following service uses the current Traefik v3.7 image pattern, the Docker provider, a read-only Docker socket, a secure entrypoint on 443, and persistent ACME storage. It selects TLS-ALPN-01. Add port 80 only if you also need HTTP-01 or an HTTP-to-HTTPS redirect.

services:
  traefik:
    image: traefik:v3.7
    restart: unless-stopped
    command:
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.websecure.address=:443
      - --certificatesresolvers.myresolver.acme.tlschallenge=true
      - --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
    ports:
      - '443:443'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./letsencrypt:/letsencrypt
    networks:
      - proxy

networks:
  proxy:
    external: true
    name: traefik_proxy

The Docker socket is mounted read-only so Traefik can watch container labels without being given write access through the socket. The resolver name, myresolver, is arbitrary, but it must match the resolver name used in the WordPress labels.

Using HTTP-01 instead

Replace the TLS challenge flag with the HTTP challenge flags and add a web entrypoint and port mapping:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
      - --entrypoints.web.address=:80
      - --certificatesresolvers.myresolver.acme.httpchallenge=true
      - --certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web
    ports:
      - '80:80'
      - '443:443'

Do not enable both challenge methods accidentally while troubleshooting. Pick one validation path, verify that its public port reaches this container, and inspect the logs for that resolver.

Attach WordPress to Traefik

Add the labels below to the existing WordPress service in the same Compose project, or copy the labels into the project that runs WordPress. The service must join the external traefik_proxy network. Keep your database network and database credentials as they are; only the reverse-proxy connection is shown here.

services:
  wordpress:
    # Keep your existing WordPress image, environment and volumes here.
    networks:
      - proxy
      - wordpress-internal
    labels:
      - traefik.enable=true
      - traefik.http.routers.wordpress.rule=Host(`example.com`)
      - traefik.http.routers.wordpress.entrypoints=websecure
      - traefik.http.routers.wordpress.tls=true
      - traefik.http.routers.wordpress.tls.certresolver=myresolver
      - traefik.http.services.wordpress.loadbalancer.server.port=80

networks:
  proxy:
    external: true
    name: traefik_proxy
  wordpress-internal:
    driver: bridge

Replace example.com with the hostname in DNS. The final label tells Traefik to send traffic to port 80 inside the WordPress container, even though that port is not published on the host.

Why each label matters

  • traefik.enable=true opts this container into routing because automatic exposure is disabled.
  • The Host rule prevents Traefik from sending unrelated hostnames to WordPress.
  • entrypoints=websecure binds the router to the HTTPS listener.
  • tls=true declares that this router handles HTTPS traffic.
  • tls.certresolver=myresolver selects the ACME resolver configured on Traefik.
  • The load-balancer port must be the port that the WordPress container actually listens on inside Docker.

If WordPress is attached to several Docker networks, make sure Traefik can resolve it through the shared proxy network. A container that is not on the same network cannot be reached even when its labels are correct.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start the stack and request the certificate

  1. Confirm DNS resolves the hostname to the public server and that the selected challenge port is forwarded to Traefik.
  2. Validate the Compose syntax with docker compose config. Fix indentation, duplicate service names and unresolved environment variables before starting.
  3. Start or recreate the services with docker compose up -d.
  4. Watch Traefik while the first request triggers ACME activity: docker compose logs -f traefik.
  5. Open https://example.com from a network outside the server. Confirm that the certificate names the requested hostname and that WordPress loads through the Traefik router.

Certificate issuance may not happen until Traefik receives a request for the router. Keep the terminal attached to the logs during the first test so DNS, port and resolver errors are visible at the time they occur.

Redirect HTTP requests to HTTPS safely

If you publish both entrypoints, add a redirect router after certificate issuance is working. A common label pattern is:

      - traefik.http.routers.wordpress-http.rule=Host(`example.com`)
      - traefik.http.routers.wordpress-http.entrypoints=web
      - traefik.http.routers.wordpress-http.middlewares=redirect-to-https
      - traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https

The redirect middleware changes ordinary HTTP visits to HTTPS. When using HTTP-01, ensure the ACME challenge path remains serviceable through the validation flow; do not assume that a blanket redirect is harmless until a staging issuance succeeds.

TLS-ALPN-01 does not require port 80 for validation, but publishing 80 can still be useful for redirecting visitors. HTTP-01 does require the web entrypoint and public port 80, so removing that mapping later will prevent renewals.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Test with the staging certificate authority first

Repeated production failures can trigger certificate-authority rate limits. For a safe test, set Traefik’s ACME CA server to the Let’s Encrypt staging directory. A successful staging request returns a certificate issued by “Fake LE Intermediate X1”; browsers will not trust it, but it proves that DNS, reachability, router labels and the challenge flow work together.

  1. Add the staging CA server option to the Traefik command for the selected resolver.
  2. Restart Traefik and request the hostname again.
  3. Check the logs for successful validation and the staging issuer.
  4. Remove the staging option.
  5. Delete the staging acme.json (or move it aside), recreate an empty protected file, and restart Traefik so it requests a production certificate.

Do not leave staging data in place when you expect a browser-trusted certificate. Staging certificates are deliberately untrusted and must be replaced by a production issuance.

Best Value
Docker Container Linux Devops Programming Coding T-Shirt
  • Docker, Docker Swarm, Docker Compose, Programmer, Developer, Coding, Programming, Software Engineer, Code, DevOps, Deploy, Deployment, Kubernetes, Salt, Puppet, Chef, Terraform, Container, AWS, Azure, Cloud, Geek, Funny, Computer, Software, Tech, IT
  • Integration, Scrum, Compile, Compilation, Science, Bug, Debug, Python, Linux, Java, Javascript, Scala, Dotnet, Kotlin
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the common failures

A 404 response

A 404 usually means the request did not match the intended router. Check the exact hostname in the browser against the Host rule, verify that the request arrives on the entrypoint named by the router, and confirm that the WordPress service is on the shared Docker network. Also check that the load-balancer port is the container’s listening port, not a host-published port that does not exist.

Traefik serves its default certificate

The default certificate appears when Traefik cannot select a certificate covering the requested hostname. Typical causes are an ACME request that never completed, a resolver name mismatch, a Host rule for a different name, or DNS pointing to another server. Read the Traefik logs, verify that the router has tls=true, and confirm that the selected resolver is attached to that router.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ACME validation times out

  • Resolve the hostname from an external network and compare the result with the server’s public address.
  • Test port 443 for TLS-ALPN-01 or port 80 for HTTP-01 from outside the host.
  • Inspect cloud security groups, the local firewall and upstream NAT rules.
  • Check whether another process already owns the required port.
  • Ensure the challenge entrypoint name in the resolver exactly matches the entrypoint address.

Traefik cannot read ACME storage

Confirm that the host directory exists, the file is mounted at /letsencrypt/acme.json, and the Docker process can read and write it. A missing mount causes certificates to disappear after recreation; a read-only or inaccessible file prevents issuance and renewal. Keep one persistent file for the active environment and back it up securely.

WordPress is unreachable after the certificate succeeds

This separates certificate validation from backend routing. Check that the WordPress container is running, that Traefik and WordPress share a network, and that the service label points to the internal WordPress port. A valid certificate only proves that Traefik completed TLS; it does not prove that the backend is healthy.

Traefik v3 configuration versus older v2 examples

Many tutorials still show Traefik v2 syntax or older image tags. Compare the installed release with the example before copying flags. The current repository pattern in this setup uses traefik:v3.7, the Docker provider, providers.docker.exposedbydefault=false, an entrypoint address, and the same ACME resolver concepts used by v2.

Item Current pattern used here What to verify in an older example
Image traefik:v3.7 Do not assume an unpinned or v2 image has identical defaults.
Docker exposure --providers.docker.exposedbydefault=false Confirm the provider flag is present and that each intended service has traefik.enable=true.
HTTPS router Secure entrypoint, tls=true, and a named certificate resolver Check that the older labels still map to the release you installed.
ACME persistence /letsencrypt/acme.json mounted from the host Verify the storage path in both the command and the volume mount.

Read the configuration reference for the exact release you deploy when an option has changed. A syntactically valid label can still produce no route if its entrypoint or provider name does not match the running configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Operational checklist for renewals and recovery

  • Keep the DNS record pointed at the same publicly reachable host for the lifetime of the certificate.
  • Leave the challenge port reachable whenever renewals require it: 443 for TLS-ALPN-01, or 80 for HTTP-01.
  • Persist and back up acme.json; never recreate it casually on every deployment.
  • Protect the file and the Docker socket. The socket is mounted read-only in the example, and the ACME file should not be publicly readable.
  • Use explicit labels so only the WordPress service is exposed.
  • After changing DNS, ports, entrypoints, resolver names or labels, inspect logs and test from an external network.
  • Use staging for structural changes, then remove staging state before requesting the trusted production certificate.

With DNS, reachability, persistent ACME storage and labels aligned, Traefik can terminate HTTPS for WordPress while Docker keeps the application private. The most important diagnostic order is DNS first, public port reachability second, resolver and certificate state third, and router-to-container networking last.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.