Hello, I've been having difficulty configuring the SSL certificate for a few days, despite having carried out the same configuration in other applications.
It is worth mentioning, the purpose of the certificate is to be installed in a docker container, whose subdomain is pointed to the host server that docker is on.
The main domain is pointed to another hosting and has another SSL certificate.
Which stack?
Docker + Certbot + Nginx
I ran this command:
Certonly --webroot -w /var/www/certbot --force-renewal --email [redacted] -d api.budesk.com --agree-tos
It produced this output:
letsencrypt.log > 2023-09-16 05:36:01,838:DEBUG:certbot._internal.main:certbot version: 2.6.0202 - Pastebin.com
My web server is (from docker compose):
image: nginx:latest
The operating system my web server runs on is (include version):
Host system: Debian GNU/Linux 10 (buster)
Docker: Docker Engine - Community 24.0.2 (Docker Compose version v2.18.1)
My hosting provider, if applicable, is:
budesk.com > hostinger (keep on this hosting provider)
api.budesk.com > hostinger (dns type "A" set name to api and content to 51.222.158.192, which is the ip address of the docker host from ovh.pt, other provider)
I can login to a root shell on my machine (yes or no, or I don't know):
Yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
No
The version of my client is (e.g. output of certbot --version
or certbot-auto --version
if you're using Certbot):
image: certbot/certbot
My docker compose file:
nginx:
container_name: nginx
restart: unless-stopped
image: nginx
ports:
- 80:80
- 443:443
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./certbot/conf:/etc/letsencrypt
- ./certbot/www:/var/www/certbot
networks:
- budesk
certbot:
image: certbot/certbot
container_name: certbot
volumes:
- ./certbot/conf:/etc/letsencrypt
- ./certbot/www:/var/www/certbot
- ./certbot/log:/var/log/letsencrypt
command: certonly --webroot -w /var/www/certbot --force-renewal --email gabriel@budesk.com -d api.budesk.com --agree-tos
Nginx conf:
http {
server_tokens off;
charset utf-8;
server {
listen 80 default_server;
server_name _;
location ^~ /.well-known/acme-challenge/ {
allow all;
root /var/www/certbot;
index index.php index.html index.htm;
}
location / {
proxy_pass http://165.40.0.2:8000;
}
}
}
Folder structure (host)
|- cerbot
|- nginx
|- nginx.conf
|- docker-compose.yml
I actually tried many methods, and they all point to this error, I'm thinking it might be something related to the lets-encrypt challenge validations.
The files in the subdirectories are created, including in certbot/www, but the application is not successful.