Update README.md

This commit is contained in:
propheth 2021-02-25 21:00:06 +01:00 committed by GitHub
parent 2f71008ea4
commit b9c182ade1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,8 @@ services:
whoami:
image: jwilder/whoami
environment:
- VIRTUAL_HOST=whoami.local
- VIRTUAL_HOST=whoami.local,www.whoami.local
- REDIRECT=www.whoami.local
```
```shell
@ -82,6 +83,10 @@ If you need to support multiple virtual hosts for a container, you can separate
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](http://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`](http://nginx.org/en/docs/http/server_names.html).
### Redirect Hosts
Using the `REDIRECT` environment variable, you can 301 permanent redirect all your virtual hosts to a specific host. Commonly used in production for SEO purposes. For example, you can redirect both `www.bar.com,bar.com` to `www.bar.com` using `REDIRECT=www.bar.com` or `www.bar.com,bar.com` to `bar.com` using `REDIRECT=bar.com`.
### Multiple Networks
With the addition of [overlay networking](https://docs.docker.com/engine/userguide/networking/get-started-overlay/) 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`.