Repolode
nginx-proxy

nginx-proxy/nginx-proxy

Docker-based Nginx reverse proxy that automatically generates routing configs from running containers' VIRTUAL_HOST variables.

Stars
19,935
Forks
3,038
Open issues
329
Last commit
6 days ago

What is it?

nginx-proxy runs an Nginx container alongside docker-gen, which watches the Docker daemon. When containers start or stop, docker-gen regenerates the Nginx reverse proxy configuration and reloads Nginx, so new services are routed without manual config edits.

To proxy a container, you set a VIRTUAL_HOST environment variable to the domain it should answer to, and point DNS at the host. The proxied container must expose its port and share a Docker network with the nginx-proxy container. Images are published in Debian, Alpine, and dockergen variants, and the project recommends pinning explicit version tags for production.

The repository is maintained by ZeroSSL, and the project is documented in its docs directory for additional options such as virtual ports and custom external HTTP/HTTPS ports.

Key features

  • 01Generates Nginx proxy configs automatically from running Docker containers.
  • 02Routes requests by the VIRTUAL_HOST environment variable.
  • 03Reloads Nginx when containers start or stop.
  • 04Offers Debian, Alpine, and dockergen image variants.
  • 05Supports custom virtual ports and external HTTP/HTTPS ports via documented options.

Use cases

  • Hosting multiple web apps on one server, each under its own domain.
  • Adding new Dockerized services to a reverse proxy without editing Nginx config by hand.
  • Running a shared ingress container for a Docker host with several sites.

Quick start

  1. 1

    Start the nginx-proxy container with the Docker socket mounted

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

    Start a container with the VIRTUAL_HOST environment variable set to the hostname you want to proxy

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

Things to know

  • Requires Docker, and the proxy needs access to the Docker socket.
  • Proxied containers must expose their port and share a Docker network with nginx-proxy.
  • Port numbers in VIRTUAL_HOST are not supported; separate docs cover workarounds.

Topics

FAQ

What is nginx-proxy?
Docker-based Nginx reverse proxy that automatically generates routing configs from running containers' VIRTUAL_HOST variables. nginx-proxy runs an Nginx container alongside docker-gen, which watches the Docker daemon. When containers start or stop, docker-gen regenerates the Nginx reverse proxy configuration and reloads Nginx, so new services are routed without manual config edits.
Is nginx-proxy free to use? What license does it have?
nginx-proxy is open source under the MIT license. Check the license terms before using it in commercial products.
Is nginx-proxy still maintained?
Actively maintained. The last commit to nginx-proxy was on Nov 2, 2026.
What can I use nginx-proxy for?
Hosting multiple web apps on one server, each under its own domain. Adding new Dockerized services to a reverse proxy without editing Nginx config by hand. Running a shared ingress container for a Docker host with several sites.
How do I install nginx-proxy?
Start the nginx-proxy container with the Docker socket mounted: docker run --detach --name nginx-proxy --publish 80:80 --volume /var/run/docker.sock:/tmp/docker.sock:ro nginxproxy/nginx-proxy:1.11 Start a container with the VIRTUAL_HOST environment variable set to the hostname you want to proxy: docker run --detach --name your-proxied-app --env VIRTUAL_HOST=foo.bar.com nginx
Where can I get nginx-proxy?
The source code and installation instructions are on GitHub: https://github.com/nginx-proxy/nginx-proxy

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects