Closed gerwinov closed 6 years ago
I think DEFAULT_HOST is the environment variable you are looking for: https://github.com/jwilder/nginx-proxy#default-host
Thanks for your quick reply.
I tried it like this:
nginx-gen:
restart: always
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
- "./volumes/proxy/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro"
volumes_from:
- nginx
entrypoint: /bin/sh -c
environment:
- DEFAULT_HOST=XXXX (same name as one VIRTUAL_HOST further down in the file)
command: ["/usr/local/bin/docker-gen -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf"]
This however does not seem to work. When I visit my server by IP address I get a 503 nginx error. Do you have any suggestions?
Thanks in advance!
Best regards, Gerwin
Haven't tried this but it looks good to me... Did you recreate the containers?
BTW, you can check the generated nginx config with docker exec nginx cat /etc/nginx/conf.d/default.conf
Recreating the containers (using docker-compose up --force-recreate
) did the trick for me. Rookie mistake I guess.. Thanks a lot!
Hi @gilyes,
I have a question regarding my docker-compose file. I would like to setup a default / catch all website that is being displayed when no other virtual host is met. Currently I get a standard 503 page from nginx as default. Below is my docker-compose file. The current setup is working for the service where a specific virtual host is present. It is nog working for the default-site. I am trying to set the 'default-website' as default. Can you maybe spot the error and help me configuring this?
Thanks in advance!
Best regards, Gerwin