Unable to Generate SSL cert using docker-compose

Hi,
I'm using Docker Compose to auto-generate the SSL for my domain

version: '3.8'
name: infra-main
services:
nginx:
container_name: infra-main-nginx
image: ghcr.io/rihal-om/infra-rihal-om/nginx:latest
restart: always
ports:
- 80:80
- 443:443
volumes:
- '/var/run/docker.sock:/tmp/docker.sock:ro'
- 'vhost:/etc/nginx/vhost.d'
- 'html:/usr/share/nginx/html'
- 'certs:/etc/nginx/certs'
- '/docker/volumes/infra-main/nginx/config:/etc/nginx/conf.d'

acme:
container_name: infra-main-acme
image: nginxproxy/acme-companion
restart: always
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
- 'acme:/etc/acme.sh'
environment:
DEFAULT_EMAIL: user@xyz.com
volumes_from:
- 'nginx'

volumes:
vhost:
html:
certs:
acme:

networks:
default:
name: shared-network
external: true

Invalid status,domain-name:Verify error detail:151.104.132.210: Invalid response from http://domain/.well-known/acme-challenge/53P1P7CDyRpr8BjCbPORc2wpmwOqoUQd6ORHuOaLE9I: 404

How can I fix this?

The "404" is an HTTP Not Found error. It means you are using an HTTP Challenge (probably webroot since you don't show command I have to guess). For webroot acme.sh places a challenge token file in the webroot folder you specify. The Let's Encrypt server then makes an HTTP request to your domain requesting that challenge file. But, your nginx says it was not found.

With multiple docker containers, this usually means the webroot folder for acme.sh is not your nginx root folder for this domain. Check your volume statements to be sure these map to the same location.

2 Likes

This Docker Compose file was working before, I'm unable to understand what happened now. It was quite simple we just did docker-compose up and it verified the domain but now it is complaining this

The only part that is failing is at the end with the test acme-challenge.

When I curl an HTTP link I get a 404.

I have no idea how to fix this. I've been at it for a few days.

Any ideas?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.