Unable to setup HTTPS using Nginx, Certbot and Docker

I am currently working to setup Docker in order to deploy the website I created. However, I’m stuck at the level of configuring https with Nginx and Certbot.

Here is everything I did :

  • Bought a domain name on OVH Cloud and added an A entry in the DNS pointing to my local windows machine (on which i run the containers to test if the website is working)
  • Created the docker-compose.yml file with the following content :
services:
    mysql_database:
        build: ./database
        environment:
            MYSQL_ROOT_PASSWORD: test
            MYSQL_DATABASE: ranking
        ports:
            - 3316:3306
  
    flask-api:
        build: ./server
        environment:
            MYSQL_HOST: mysql_database
            MYSQL_PORT: 3306
            MYSQL_DATABASE: ranking
            MYSQL_USER: root
            MYSQL_PASSWORD: test
            DEBUG: False
            SMASHGG_API_KEY: 1132567b3267
        depends_on:
            - mysql_database
  
    frontend:
        build: ./client
        ports: 
            - 80:80
            - 443:443
        volumes:
            - ./certbot/www/:/var/www/certbot/:ro
            - ./certbot/conf/:/etc/nginx/ssl/:ro
        depends_on:
            - flask-api
  
    certbot:
        image: certbot/certbot:latest
        volumes:
            - ./certbot/www/:/var/www/certbot/:rw
            - ./certbot/conf/:/ect/letsencrypt/:rw
  • Where the frontend service is build using this Dockerfile :
# Utiliser une image Nginx de base
FROM nginx:latest

# Supprimer le fichier de configuration par défaut de Nginx
RUN rm /etc/nginx/conf.d/default.conf

# Copier le fichier de configuration personnalisé
COPY nginx.conf /etc/nginx/conf.d

# Copier les fichiers de build de Vue.js dans le répertoire d'hébergement de Nginx
COPY dist/ /usr/share/nginx/html

# Exposer le port 80 pour le serveur web
EXPOSE 80
  • And the nginx.conf file is this one :

    events {
        worker_connections 1024;
    }
    
    http {    
        server {
            listen 80;
    
            server_name seeding.gg www.seeding.gg;
    
            location /.well-known/acme-challenge/ {
                root /var/www/certbot;
            }
    
            location / {
                return 301 https://$host$request_uri;
            }
        }
    
        server {
            listen 443 ssl;
    
            server_name seeding.gg www.seeding.gg;
    
            ssl_certificate /etc/nginx/ssl/live/seeding.gg/fullchain.pem;
            ssl_certificate_key /etc/nginx/ssl/live/seeding.gg/privkey.pem;
            
            location / {
                root /usr/share/nginx/html;
                index index.html;
                try_files $uri $uri/ /index.html;
            }
    
            location /api/ {
                proxy_pass http://flask-api:5000/;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
            }
        }
    }

  • Created a folder named certbot that contains 2 folders named conf and www that are currently empty (for the volumes)
  • Added 1 inbound rule to my firewall for ports 80 and 443
  • Added 1 outbound rule to my firewall for ports 80 and 443

However, when I run the command docker compose run --rm certbot certonly --webroot --webroot-path /var/www/certbot/ -d www.seeding.gg to get the certificates, I get the following error :

Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
    Domain: www.seeding.gg
    Type:   dns
    Detail: no valid A records found for www.seeding.gg; no valid AAAA records found for www.seeding.gg

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.

Some challenges have failed.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

Could you help me with this issue please ?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật