nginx-proxy sets up a container running nginx and docker-gen⁠ https://hub.docker.com/r/nginxproxy/nginx-proxy

Nicolas Duchon a2bdbcd3ed Merge pull request #2641 from ArtARTs36/patch-1 2 hónapja
.github def3131239 ci: disable fail-fast on test workflow 4 hónapja
app de4cb3d2b0 refactor: move nginx daemon off to procfile 1 éve
docs 6ebf9d6fac Merge pull request #2587 from antoniomika/am/proxy-protocol 2 hónapja
test 872e5b5646 feat: global proxy protocol support 2 hónapja
.dockerignore 4ea3437dfa chore: include license into the Docker images 3 éve
.gitignore ce2e076d65 chore: add wip folder to .gitignore 10 hónapja
Dockerfile.alpine ed3f93adde build: bump nginxproxy/docker-gen from 0.14.7-debian to 0.15.0-debian 2 hónapja
Dockerfile.debian ed3f93adde build: bump nginxproxy/docker-gen from 0.14.7-debian to 0.15.0-debian 2 hónapja
LICENSE 679c971a19 docs: update maintainers list on license 3 éve
Makefile db55ddcab4 ci: use build matrix rather than separate jobs 1 éve
README.md 8911ceffaf docs: bump docker image version 2 hónapja
docker-compose-separate-containers.yml fbad3ac3fc chore: docker compose version is obsolete 9 hónapja
docker-compose.yml fbad3ac3fc chore: docker compose version is obsolete 9 hónapja
network_internal.conf 28c74e8dae fix: Move NETWORK_ACCESS to location block 3 éve
nginx.tmpl 7391ce96fe feat: pass X-Real-IP header to gRPC backends 2 hónapja

README.md

Test GitHub release nginx 1.29.0 Docker Image Size Docker stars Docker pulls

nginx-proxy sets up a container running nginx and docker-gen. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.

See Automated Nginx Reverse Proxy for Docker for why you might want to use this.

Usage

To run it:

docker run --detach \
    --name nginx-proxy \
    --publish 80:80 \
    --volume /var/run/docker.sock:/tmp/docker.sock:ro \
    nginxproxy/nginx-proxy:1.8

Then start any containers (here an nginx container) you want proxied with an env var VIRTUAL_HOST=subdomain.yourdomain.com

docker run --detach \
    --name your-proxied-app \
    --env VIRTUAL_HOST=foo.bar.com \
    nginx

Provided your DNS is setup to resolve foo.bar.com to the host running nginx-proxy, a request to http://foo.bar.com will then be routed to a container with the VIRTUAL_HOST env var set to foo.bar.com (in this case, the your-proxied-app container).

The containers being proxied must :

  • expose the port to be proxied, either by using the EXPOSE directive in their Dockerfile or by using the --expose flag to docker run or docker create.
  • share at least one Docker network with the nginx-proxy container: 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.

Note: providing a port number in VIRTUAL_HOST isn't suported, please see virtual ports or custom external HTTP/HTTPS ports depending on what you want to achieve.

Image variants

The nginx-proxy images are available in two flavors.

Debian based version

This image is based on the nginx:mainline image, itself based on the debian slim image.

docker pull nginxproxy/nginx-proxy:1.8

Alpine based version (-alpine suffix)

This image is based on the nginx:alpine image.

docker pull nginxproxy/nginx-proxy:1.8-alpine

[!IMPORTANT]

A note on latest and alpine:

It is not recommended to use the latest (nginxproxy/nginx-proxy, nginxproxy/nginx-proxy:latest) or alpine (nginxproxy/nginx-proxy:alpine) tag for production setups.

Those tags point to the latest commit in the main branch. They do not carry any promise of stability, and using them will probably put your nginx-proxy setup at risk of experiencing uncontrolled updates to non backward compatible versions (or versions with breaking changes). You should always specify the version you want to use explicitly to ensure your setup doesn't break when the image is updated.

Additional documentation

Please check the docs section.

Powered by

GoLand logo PyCharm logo