Addresses #1020 by providing another means to identify the CurrentContainer
This commit is contained in:
parent
b0c6c9f67e
commit
3e62a9247f
2 changed files with 11 additions and 9 deletions
18
README.md
18
README.md
|
@ -10,7 +10,7 @@ See [Automated Nginx Reverse Proxy for Docker][2] for why you might want to use
|
||||||
|
|
||||||
To run it:
|
To run it:
|
||||||
|
|
||||||
$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy
|
$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro -e NGINX_PROXY_CONTAINER=true jwilder/nginx-proxy
|
||||||
|
|
||||||
Then start any containers you want proxied with an env var `VIRTUAL_HOST=subdomain.youdomain.com`
|
Then start any containers you want proxied with an env var `VIRTUAL_HOST=subdomain.youdomain.com`
|
||||||
|
|
||||||
|
@ -48,6 +48,8 @@ services:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||||
|
environment:
|
||||||
|
- NGINX_PROXY_CONTAINER=true
|
||||||
|
|
||||||
whoami:
|
whoami:
|
||||||
image: jwilder/whoami
|
image: jwilder/whoami
|
||||||
|
@ -128,11 +130,11 @@ backend container. Your backend container should then listen on a port rather
|
||||||
than a socket and expose that port.
|
than a socket and expose that port.
|
||||||
|
|
||||||
### FastCGI Backends
|
### FastCGI Backends
|
||||||
|
|
||||||
If you would like to connect to FastCGI backend, set `VIRTUAL_PROTO=fastcgi` on the
|
If you would like to connect to FastCGI backend, set `VIRTUAL_PROTO=fastcgi` on the
|
||||||
backend container. Your backend container should then listen on a port rather
|
backend container. Your backend container should then listen on a port rather
|
||||||
than a socket and expose that port.
|
than a socket and expose that port.
|
||||||
|
|
||||||
### FastCGI File Root Directory
|
### FastCGI File Root Directory
|
||||||
|
|
||||||
If you use fastcgi,you can set `VIRTUAL_ROOT=xxx` for your root directory
|
If you use fastcgi,you can set `VIRTUAL_ROOT=xxx` for your root directory
|
||||||
|
@ -292,11 +294,11 @@ site after changing this setting, your browser has probably cached the HSTS poli
|
||||||
redirecting you back to HTTPS. You will need to clear your browser's HSTS cache or use an incognito
|
redirecting you back to HTTPS. You will need to clear your browser's HSTS cache or use an incognito
|
||||||
window / different browser.
|
window / different browser.
|
||||||
|
|
||||||
By default, [HTTP Strict Transport Security (HSTS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security)
|
By default, [HTTP Strict Transport Security (HSTS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security)
|
||||||
is enabled with `max-age=31536000` for HTTPS sites. You can disable HSTS with the environment variable
|
is enabled with `max-age=31536000` for HTTPS sites. You can disable HSTS with the environment variable
|
||||||
`HSTS=off` or use a custom HSTS configuration like `HSTS=max-age=31536000; includeSubDomains; preload`.
|
`HSTS=off` or use a custom HSTS configuration like `HSTS=max-age=31536000; includeSubDomains; preload`.
|
||||||
*WARNING*: HSTS will force your users to visit the HTTPS version of your site for the `max-age` time -
|
*WARNING*: HSTS will force your users to visit the HTTPS version of your site for the `max-age` time -
|
||||||
even if they type in `http://` manually. The only way to get to an HTTP site after receiving an HSTS
|
even if they type in `http://` manually. The only way to get to an HTTP site after receiving an HSTS
|
||||||
response is to clear your browser's HSTS cache.
|
response is to clear your browser's HSTS cache.
|
||||||
|
|
||||||
### Basic Authentication Support
|
### Basic Authentication Support
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
|
{{ $CurrentContainer := or (where $ "ID" .Docker.CurrentContainerID | first) (where $ "Env.NGINX_PROXY_CONTAINER" "true" | first) }}
|
||||||
|
|
||||||
{{ $external_http_port := coalesce $.Env.HTTP_PORT "80" }}
|
{{ $external_http_port := coalesce $.Env.HTTP_PORT "80" }}
|
||||||
{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }}
|
{{ $external_https_port := coalesce $.Env.HTTPS_PORT "443" }}
|
||||||
|
|
Loading…
Reference in a new issue