0

I needed to host multiple domains, so I followed this blog: https://www.datanovia.com/en/lessons/how-host-multiple-https-websites-on-one-server/ with the following configuration for my nginx-proxy:

version: '3'

services:
  nginx:
    image: nginx:1.13.1
    container_name: nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - conf:/etc/nginx/conf.d
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"

  dockergen:
    image: jwilder/docker-gen:0.7.3
    container_name: nginx-proxy-gen
    depends_on:
      - nginx
    command: -notify-sighup nginx-proxy -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
    volumes:
      - conf:/etc/nginx/conf.d
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
  
  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nginx-proxy-le
    depends_on:
      - nginx
      - dockergen
    environment:
      NGINX_PROXY_CONTAINER: nginx-proxy
      NGINX_DOCKER_GEN_CONTAINER: nginx-proxy-gen
    volumes:
      - conf:/etc/nginx/conf.d
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs
      - /var/run/docker.sock:/var/run/docker.sock:ro

volumes:
  conf:
  vhost:
  html:
  certs:

# Do not forget to 'docker network create nginx-proxy' before launch, and to add '--network nginx-proxy' to proxyed containers. 

networks:
  default:
    external:
      name: nginx-proxy

and for my Wordpress I have:

version: "3"

services:
  wp_db:
    image: mysql:8.0
    restart: always
    env_file: .env
    environment:
      - MYSQL_DATABASE=wordpress
    container_name: wp_db
    volumes: 
      - dbdata:/var/lib/mysql
      - "./backups/db:/backups"
      - "./config:/config"
    command: '--default-authentication-plugin=mysql_native_password'


  example_domain_wp:
    container_name: example_domain_wp
    depends_on:
      - wp_db
    image: wordpress:latest
    expose:
      - 80
    restart: always
    environment:
      VIRTUAL_HOST: example.com 
      VIRTUAL_PORT: 80
      LETSENCRYPT_HOST: example.com
      LETSENCRYPT_EMAIL: some.email@gmail.com
      WORDPRESS_DB_HOST : wp_db:3306
      WORDPRESS_DB_USER : $MYSQL_USER
      WORDPRESS_DB_PASSWORD : $MYSQL_PASSWORD
      WORDPRESS_DB_NAME : wordpress
      WORDPRESS_CONFIG_EXTRA: |
        define('WP_DEBUG', false);
        define('WP_DEBUG_DISPLAY', false);
    volumes:
      - ./php/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
      - ./wp-content:/var/www/html/wp-content
volumes:
  dbdata:

networks:
  default:
    external:
      name: nginx-proxy

when I run the services with docker-compose, I'm getting:

Verify error:Invalid response from https://example.com/.well-known/acme-challenge/SOME_ID

I'm running the docker on the Ubuntu 18 LTS.

Any idea how to fix it?

Many thanks.

S.Hossein Asadollahi
  • 1,450
  • 2
  • 17
  • 22
  • 1
    it seems like you are trying to verify the ownership of the domain and it fails during the verification from the `https://example.com`. I am nearly 100% positive you don't own this domain, you may want to check your configuration and make sure you are not using it. – jabbson Nov 07 '21 at 21:13
  • I own the domain, I've edited the question again. – S.Hossein Asadollahi Nov 09 '21 at 20:29

0 Answers0