I am trying to use the nginx-proxy docker container, but if I point to my domain with no subdomain (mydomain.com) then I just get the welcome page. I am using Docker-Compose and my .yml file looks like this:
proxy:
image: jwilder/nginx-proxy
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
DEFAULT_HOST: mydomain.com
ports:
- "80:80"
frontend:
image: julienvincent/nginx:react
ports:
- "8000:80"
expose:
- "80"
volumes:
- frontend/src/build:/data/www
environment:
VIRTUAL_HOST: www.mydomain.com, mydomain.com
Is this an error in my configuration?
Your mistake is with the VIRTUAL_HOST
environment variable. When you want to set its value with multiple domains, you MUST not use any space character.
Change it to VIRTUAL_HOST: www.mydomain.com,mydomain.com
and everything will work out as expected.