Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

nginx-proxy

> DevOps
Open source

Automated Nginx Reverse Proxy for Docker

19.9K stars0 likes1 views
WebsiteGitHub

About

Automated Nginx Reverse Proxy for Docker

nginx-proxy

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:

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

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

bash
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.

bash
docker pull nginxproxy/nginx-proxy:1.11

Alpine based version (-alpine suffix)

This image is based on the nginx:alpine image.

bash
docker pull nginxproxy/nginx-proxy:1.11-alpine

Dockergen version (-dockergen suffix)

This image is meant to be used in a separate containers setup with the official nginx image.

bash
docker pull nginxproxy/nginx-proxy:1.11-dockergen

[!IMPORTANT]

A note on latest, alpine and dockergen tags:

It is not recommended to use the latest (nginxproxy/nginx-proxy, nginxproxy/nginx-proxy:latest), alpine (nginxproxy/nginx-proxy:alpine) or dockergen (nginxproxy/nginx-proxy:dockergen) 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

About this repository

[!NOTE] This repository is officially maintained by ZeroSSL as part of our commitment to secure and reliable SSL/TLS solutions.
We welcome contributions and feedback from the community!
For more information about our services, including free and paid SSL/TLS certificates, visit https://zerossl.com.

	</picture>
</a>

Issues· 330 open

View all issuesOpen on GitHub
  • #2781

    Unable to proxy for container with host mode networking in Swarm

    Updated Sep 22, 2026
  • #2779

    Nginx urgent updates for old image / fresh nginx version while no new nginx-proxy

    Updated Sep 21, 2026
  • #2777

    CONNECT option

    Updated Sep 14, 2026
  • #2148

    Migrate from environment variables to container labels

    Updated Aug 1, 2026
  • #2762

    Pod containers marked `(unreachable)` due to strict `EndpointID` check in v1.11.3 breaking `podman` compatability

    Updated Jul 31, 2026
  • #2769

    Bug / Question: valid_referers in a custom vhost location causes image requests to fail (404) when using nginx-proxy

    Updated Jul 18, 2026
  • #2655

    nginx proxy exiting in docker compose when we get hello from palo alto networks

    Updated Jul 12, 2026
  • #1300

    nginx.tmpl config is wrong: proxy_pass {{ trim $proto }} results in 502 Bad Gateway between containers

    Updated Jun 20, 2026
  • #2637

    extend multiports to finally have a proper raw / non-http ports API

    Updated May 20, 2026
  • #2707

    Native ACME Support

    Updated May 15, 2026

> Tags

Pythondockerdocker-gennginxreverse-proxy

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理