1. The problem I’m having:
Hello friends, I humbly ask for your assistance as I have been driving myself in circles and can’t Sherlock the solution to get my subdomain to not 404. I feel that it’s a matter of a volume mis-mount between docker-compose and caddy.
[gregieandme.com] → Works fine for serving static html
[tools.gregieandme.com] → Laravel/Php site / can’t generate a certificate and returns a 404.
I believe my issue here is one of the Caddyfile php_fastcgi not matching its root to the docker-compose one, but being a novice I am not sure if getting warm. I’m trying to ensure the roots are pointed to the public laravel folder.
DNS A records are set up correctly.
Files are present in their correct directories
2. Error messages and/or full log output:
docker logs caddy
{"level":"error","ts":1748268123.4745073,"msg":"challenge failed","identifier":"tools.gregieandme.com","challenge_type":"http-01","problem":{"type":"urn:ietf:params:acme:error:unauthorized","title":"","detail":"147.79.78.19: Invalid response from http://tools.gregieandme.com/.well-known/acme-challenge/eNA1aoFDW_xTGuOvgN1YfcdkVtChRAqicQiY7OJdvKI: 404","instance":"","subproblems":null},"stacktrace":"github.com/mholt/acmez/v3.(*Client).pollAuthorization\n\tgithub.com/mholt/acmez/v3@v3.1.2/client.go:557\ngithub.com/mholt/acmez/v3.(*Client).solveChallenges\n\tgithub.com/mholt/acmez/v3@v3.1.2/client.go:378\ngithub.com/mholt/acmez/v3.(*Client).ObtainCertificate\n\tgithub.com/mholt/acmez/v3@v3.1.2/client.go:136\ngithub.com/caddyserver/certmagic.(*ACMEIssuer).doIssue\n\tgithub.com/caddyserver/certmagic@v0.23.0/acmeissuer.go:489\ngithub.com/caddyserver/certmagic.(*ACMEIssuer).Issue\n\tgithub.com/caddyserver/certmagic@v0.23.0/acmeissuer.go:382\ngithub.com/caddyserver/caddy/v2/modules/caddytls.(*ACMEIssuer).Issue\n\tgithub.com/caddyserver/caddy/v2@v2.10.0/modules/caddytls/acmeissuer.go:288\ngithub.com/caddyserver/certmagic.(*Config).obtainCert.func2\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:626\ngithub.com/caddyserver/certmagic.doWithRetry\n\tgithub.com/caddyserver/certmagic@v0.23.0/async.go:104\ngithub.com/caddyserver/certmagic.(*Config).obtainCert\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:700\ngithub.com/caddyserver/certmagic.(*Config).ObtainCertAsync\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:505\ngithub.com/caddyserver/certmagic.(*Config).manageOne.func1\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:415\ngithub.com/caddyserver/certmagic.(*jobManager).worker\n\tgithub.com/caddyserver/certmagic@v0.23.0/async.go:73"}
{"level":"error","ts":1748268123.474629,"msg":"validating authorization","identifier":"tools.gregieandme.com","problem":{"type":"urn:ietf:params:acme:error:unauthorized","title":"","detail":"147.79.78.19: Invalid response from http://tools.gregieandme.com/.well-known/acme-challenge/eNA1aoFDW_xTGuOvgN1YfcdkVtChRAqicQiY7OJdvKI: 404","instance":"","subproblems":null},"order":"https://acme-staging-v02.api.letsencrypt.org/acme/order/201932904/24908611294","attempt":1,"max_attempts":3,"stacktrace":"github.com/mholt/acmez/v3.(*Client).ObtainCertificate\n\tgithub.com/mholt/acmez/v3@v3.1.2/client.go:152\ngithub.com/caddyserver/certmagic.(*ACMEIssuer).doIssue\n\tgithub.com/caddyserver/certmagic@v0.23.0/acmeissuer.go:489\ngithub.com/caddyserver/certmagic.(*ACMEIssuer).Issue\n\tgithub.com/caddyserver/certmagic@v0.23.0/acmeissuer.go:382\ngithub.com/caddyserver/caddy/v2/modules/caddytls.(*ACMEIssuer).Issue\n\tgithub.com/caddyserver/caddy/v2@v2.10.0/modules/caddytls/acmeissuer.go:288\ngithub.com/caddyserver/certmagic.(*Config).obtainCert.func2\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:626\ngithub.com/caddyserver/certmagic.doWithRetry\n\tgithub.com/caddyserver/certmagic@v0.23.0/async.go:104\ngithub.com/caddyserver/certmagic.(*Config).obtainCert\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:700\ngithub.com/caddyserver/certmagic.(*Config).ObtainCertAsync\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:505\ngithub.com/caddyserver/certmagic.(*Config).manageOne.func1\n\tgithub.com/caddyserver/certmagic@v0.23.0/config.go:415\ngithub.com/caddyserver/certmagic.(*jobManager).worker\n\tgithub.com/caddyserver/certmagic@v0.23.0/async.go:73"}
3. Caddy version:
v2.10.0 h1:fonubSaQKF1YANl8TXqGcn4IbIRUDdfAkpcsfI/vX5U=
4. How I installed and ran Caddy:
Caddy is running via docker compose and works fine on static html sites.
a. System environment:
VPS running Ubuntu
Docker version 28.1.1, build 4eba377
b. Command:
docker compose up
c. Service/unit/compose file:
docker-compose.yml
services:
caddy:
image: caddy:latest
container_name: caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
- ./sites/gregieandme/www:/srv/site1.com
- ./sites/gregieandme/tools:/srv/laravel-app1
- ./caddy_data:/data
- caddy_config:/config
depends_on:
- laravel1
- mysql1
laravel1:
image: php:8.3-fpm
container_name: laravel1-tools.gregieandme
restart: unless-stopped
working_dir: /var/www
volumes:
- ./sites/gregieandme/tools:/var/www
depends_on:
- mysql1
mysql1:
image: mysql:8.0
container_name: mysql1-tools.gregieandme
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL1_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL1_DATABASE}
MYSQL_USER: ${MYSQL1_USER}
MYSQL_PASSWORD: ${MYSQL1_PASSWORD}
volumes:
- mysql1_data:/var/lib/mysql
d. My complete Caddy config:
Caddyfile
gregieandme.com, www.gregieandme.com {
root * /srv/site1.com
file_server
}
tools.gregieandme.com {
root * /srv/laravel-app1/public
encode gzip
php_fastcgi laravel1:9000 {
root /var/www/public
}
file_server
}
5. Links to relevant resources:
Curl response
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: curl - SSL CA Certificates
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Thank you in advance, I’m sure I’m doing something wrong here. I have a feeling the error is in my docker-compose.yml file