SSL certificate ceration not success within certbot wordpress docker contianer

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: dev.waib3tech.com

I am running certbot, and wordpress in docker container with apache from wordpress container itself. WHen i try to create the certificate, I am getting

certbot | Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
certbot | Domain: dev.waib3tech.com
certbot | Type: unauthorized
certbot | Detail: 2a02:4780:11:1084:0:32bb:5351:2: Invalid response from http://dev.waib3tech.com/.well-known/acme-challenge/OUGUnWqKGCVbFFYfs4BF9EvW-EsDGMLFqbR5TUsoAhY: 404
certbot |
certbot | Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.
certbot |
certbot | Some challenges have failed.

docker-compose.yml file is

version: '3.8'

services:

certbot:
depends_on:
- wordpress
image: certbot/certbot
container_name: certbot
volumes:
- certbot-etc:/etc/letsencrypt
- ./wordpress:/var/www/html
command: certonly --webroot --webroot-path=/var/www/html --email tests@waib3tech.com --agree-tos --no-eff-email --staging --dry-run -d dev.waib3tech.com

wordpress:
image: wordpress:latest
container_name: wp_waib3
depends_on:
- db
environment:
WORDPRESS_DB_HOST: ${WORDPRESS_DB_HOST}
WORDPRESS_DB_USER: ${WORDPRESS_DB_USER}
WORDPRESS_DB_PASSWORD: ${WORDPRESS_DB_PASSWORD}
WORDPRESS_DB_NAME: ${WORDPRESS_DB_NAME}
volumes:
- ./wordpress:/var/www/html
- ./waib3tech-staging-apache-config.conf:/etc/apache2/sites-available/000-default.conf
- certbot-etc:/etc/letsencrypt
ports:
- "80:80"
- "443:443"
networks:
- waib3tech_network

db:
image: mysql:8.3.0
container_name: mysql_waib3
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- db_data:/var/lib/mysql
ports:
- "3306:3306"
networks:
- waib3tech_network

phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin_waib3
depends_on:
- db
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ports:
- "8080:80"
networks:
- waib3tech_network

volumes:
wordpress_data:
db_data:
certbot-etc:

networks:
waib3tech_network:
driver: bridge

waib3tech-staging-apache-config.conf file is

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName dev.waib3tech.com
ServerAlias www.dev.waib3tech.com

DocumentRoot /var/www/html/

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

.htaccess files is

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]

Exclude .well-known from rewrite rules

RewriteCond %{REQUEST_URI} !^/.well-known/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I tried by adding manually the .well-known.acme-challenge and providing ownership of www-data and permission 755. The created a test file also within this, which is successfully accessed from browser. But then also certbot is giving same error.

Out of ideas and please help on how to solve this issue

I am running this on aws ec2 ubuntu 22.04 instance.

Welcome @nebup

You should correct your DNS AAAA IPv6 record. It is pointing to a LiteSpeed server and not your Apache. If you don't support IPv6 you should remove that record

2 Likes

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