Hi everybody.
1. The problem I’m having:
I’m trying to install a Wordpress site with Coolify using Caddy as the reverse-proxy. The website works with Wordpress “plain” URL format, but permalinks always return a 404 error.
Coolify defines the Caddy directives as docker labels in each website’s configuration, which you can see here:
caddy_1.encode=zstd gzip
caddy_1.handle_path.1_reverse_proxy={{upstreams 80}}
caddy_1.handle_path=/*
caddy_1.header=-Server
caddy_1.try_files={path} /index.php?{uri}
caddy_1=https://my-redacted-website.com
caddy_ingress_network=coolify
I’ve also tried editing the caddy_1.handle_path
label by replacing the /*
path with /app/*
. But that causes Wordpress to return a blank page and then none of the visits even hit the HTTP server (i.e., there are no hits at all in the logs after making that change).
2. Error messages and/or full log output:
Caddy doesn’t return any errors in its own logs, which indicates Coolify’s Caddy directives are technically valid from Caddy’s perspective. But Coolify’s HTTP server returns the error below, which shows that Caddy is telling the HTTP server to get the Wordpress page/post from the /app
directory in the file system (That’s where Cooify installs every website/app.), but of course Wordpress files are dynamically generated and not served from the file system.
[error] 37#37: *67 "/app/[wp-page-slug-redacted]/index.php" is not found (2: No such file or directory)
Also, why would Caddy’s default URLs for Wordpress produce a file path based on the Wordpress slug? That doesn’t make any sense.
How do I configure the Caddy directives inside Coolify’s Caddy labels to tell Caddy to stop directing the HTTP server to the file system for dynamically-generated Wordpress pages/posts, while also ensuring that static files like images, CSS, JS, etc. are retrieved from the file system as usual?
3. Caddy version:
Coolify pulls this Caddy docker image:
lucaslorentz/caddy-docker-proxy:2.8-alpine
4. How I installed and ran Caddy:
Coolify installs and manages the entire Caddy docker container, but it requires the docker labels to configure Caddy, as I described above.
a. System environment:
Ubuntu 24.04
Docker version 27.4.1, build b9d17ea
b. Command:
None
c. Service/unit/compose file:
None
d. My complete Caddy config:
This is what is defined in the Coolify docker config:
networks:
coolify:
external: true
j8sw0kc84osgg0s0wg00oso8:
external: true
services:
caddy:
container_name: coolify-proxy
image: 'lucaslorentz/caddy-docker-proxy:2.8-alpine'
restart: unless-stopped
extra_hosts:
- 'host.docker.internal:host-gateway'
environment:
- CADDY_DOCKER_POLLING_INTERVAL=5s
- CADDY_DOCKER_CADDYFILE_PATH=/dynamic/Caddyfile
networks:
- coolify
- j8sw0kc84osgg0s0wg00oso8
ports:
- '80:80'
- '443:443'
- '443:443/udp'
labels:
- coolify.managed=true
- coolify.proxy=true
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
- '/data/coolify/proxy/caddy/dynamic:/dynamic'
- '/data/coolify/proxy/caddy/config:/config'
- '/data/coolify/proxy/caddy/data:/data'
Please help. I’ve tried dozens of different Caddy docker label directives, asked GPT/Gemini/Claude/etc. None of them know how to resolve this.