1. Output of caddy version
:
v2.6.1 h1:EDqo59TyYWhXQnfde93Mmv4FJfYe00dO60zMiEt+pzo=
2. How I run Caddy:
Inside a Docker container, wrapped in Rymfony (to have both Caddy and PHP running)
a. System environment:
Docker, all with debian:10-slim
images
b. Command:
Rymfony launches Caddy in the container with this command:
/usr/local/bin/caddy run --watch --adapter caddyfile --config /home/.rymfony/.../Caddyfile.runtime
c. Service/unit/compose file:
Currently only the PHP container is relevant for this issue
services:
php:
build: ./docker/php/
working_dir: /srv/
ports: ['8000:8000']
volumes: ['./backend/:/srv']
command: ['rymfony', 'serve', '--document-root=/srv/public/', '--no-tls', '--port=8000']
d. My complete Caddy config:
{
log {
output file /home/.rymfony/.../log/http.server.log
}
auto_https off
}
http://127.0.0.1:8000 {
root * /srv/public/
encode gzip
header -Server
log {
output file /home/.rymfony/.../log/http.vhost.log
}
php_fastcgi 127.0.0.1:60000 {
env SERVER_SOFTWARE "Rymfony/Caddy"
index index.php
resolve_root_symlink
}
file_server
}
3. The problem I’m having:
It’s mostly an architecture question, see below after the template.
4. Error messages and/or full log output:
N/A
5. What I already tried:
All the above code (+ what’s in the linked repository)
6. Links to relevant resources:
Note: the project is there: GitHub - Pierstoval/php-js-boilerplate
It contains only boilerplate Symfony and Svelte Kit applications.
So, here it is: I have a dilemma. I’m creating a public template for an app I’ll develop, and I’m torn between “caddy-ing” everything, or using caddy only for my backend app.
The Docker Compose setup exposes frontend app to port 3000, and backend app to port 8000 using Rymfony (which uses Caddy in the background, see the runtime caddy config above)
It works, BUT, I’m wondering whether I should have one Caddy container and reverse_proxy to the frontend container and use php_fastcgi to the backend container.
I don’t know (yet) how to do that, but I’ll check anyway (maybe 2 caddy hosts with 2 different http ports I guess).
As for production, the Svelte app will be built into static files only, so production will be quite different since only the “file_server” Caddy instruction will be enough (with http caching I guess). And I will certainly not use Docker for prod anyway (just Caddy + PHP-FPM). So I can’t even think about “prod-ready” setup since this will only be for development.
For now, I mostly wonder which strategy is good:
- Caddy only for backend/PHP (by using Rymfony like now) and Node/Vite for frontend (like now)
- One Caddy to rule them all, and in the proxy to bring them
Which strategy would you rather recommend?