docker-verynginx-proxy sets up a docker compose with nginx, verynginx dashboard and docker-gen. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.
This repository is a merge with two tools:
- verynginx from camil/verynginx docker image.
- docker-gen from jwilder/nginx-proxy docker image.
- camil/verynginx
- name: nginx
- port: 80
- jwilder/docker-gen
- name: dockergen
docker-compose pull
docker-compose up -d
http://verynginx/verynginx/index.html
user: verynginx
pass: verynginx
If you need to support multiple virtual hosts for a container, you can separate each entry with commas. For example, foo.bar.com,baz.bar.com,bar.com
and each host will be setup the same.
You can also use wildcards at the beginning and the end of host name, like *.bar.com
or foo.bar.*
. Or even a regular expression, which can be very useful in conjunction with a wildcard DNS service like xip.io, using ~^foo\.bar\..*\.xip\.io
will match foo.bar.127.0.0.1.xip.io
, foo.bar.10.0.2.2.xip.io
and all other given IPs. More information about this topic can be found in the nginx documentation about server_names
.
With the addition of overlay networking in Docker 1.9, your nginx-proxy container may need to connect to backend containers on multiple networks. By default, if you don't pass the --net flag when your nginx-proxy container is created, it will only be attached to the default bridge network. This means that it will not be able to connect to containers on networks other than bridge.
If you want your nginx-proxy container to be attached to a different network, you must pass the --net=my-network option in your docker create or docker run command. At the time of this writing, only a single network can be specified at container creation time. To attach to other networks, you can use the docker network connect command after your container is created:
$ docker network connect my-other-network dockergen
$ docker network connect my-other-network nginx
$ docker restart dockergen
If you would like to connect to your backend using HTTPS instead of HTTP, set VIRTUAL_PROTO=https
on the backend container.
If you would like to connect to uWSGI backend, set VIRTUAL_PROTO=uwsgi
on the
backend container. Your backend container should than listen on a port rather
than a socket and expose that port.
To set the default host for nginx use the env var DEFAULT_HOST=foo.bar.com
for example
Check: