This commit is contained in:
Tim Schneider 2021-10-11 13:25:18 -04:00 committed by GitHub
commit f39ddbefcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

View file

@ -1,2 +1,2 @@
dockergen: docker-gen -watch -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf
dockergen: docker-gen -watch${INCLUDE_STOPPED} -notify "nginx -s reload" /app/nginx.tmpl /etc/nginx/conf.d/default.conf
nginx: nginx

View file

@ -176,6 +176,15 @@ If you would like to connect to FastCGI backend, set `VIRTUAL_PROTO=fastcgi` on
If you use fastcgi,you can set `VIRTUAL_ROOT=xxx` for your root directory
### Static File Backends
If you want your container to only serve static content, set `VIRTUAL_PROTO=static` on the container.
You can then set `VIRTUAL_ROOT=xxx` to your static files' root directory. If your static files live in a stopped
container, be sure to set the `INCLUDE_STOPPED_CONTAINERS=true` environment variable on the nginx-proxy container as
stopped containers will otherwise be ignored.
You can create a minimal docker container with your static website files in a volume. The volume can then be mounted
into the nginx-proxy container and be served with this "backend".
### Default Host

View file

@ -14,6 +14,12 @@ if [[ $DOCKER_HOST = unix://* ]]; then
fi
fi
if [ "${INCLUDE_STOPPED_CONTAINERS}" == "true" ]; then
export INCLUDE_STOPPED=" -include-stopped"
else
export INCLUDE_STOPPED=""
fi
# Generate dhparam file if required
/app/generate-dhparam.sh

View file

@ -342,6 +342,8 @@ server {
fastcgi_pass {{ trim $upstream_name }};
{{ else if eq $proto "grpc" }}
grpc_pass {{ trim $proto }}://{{ trim $upstream_name }};
{{ else if eq $proto "static" }}
root {{ trim $vhost_root }};
{{ else }}
proxy_pass {{ trim $proto }}://{{ trim $upstream_name }};
{{ end }}
@ -394,6 +396,8 @@ server {
fastcgi_pass {{ trim $upstream_name }};
{{ else if eq $proto "grpc" }}
grpc_pass {{ trim $proto }}://{{ trim $upstream_name }};
{{ else if eq $proto "static" }}
root {{ trim $vhost_root }};
{{ else }}
proxy_pass {{ trim $proto }}://{{ trim $upstream_name }};
{{ end }}