nginx-proxy /nginx-proxy
Automated Nginx Reverse Proxy for Docker
★ 19,942⑂ 3,037👁 255⑃ 906● 1,399▤ 41
+0
日增长
19,942
stars
3,037
forks
255
watchers
906
prs
1,399
issues
41
releases
README
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:
shell
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
shell
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.
shell
docker pull nginxproxy/nginx-proxy:1.11
Alpine based version (-alpine suffix)
This image is based on the nginx:alpine image.
shell
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.
shell
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 ZTop issues
#97Docker Swarm Support or Multiple Node Support55 comments · 2015-02-06#981jwilder/nginx-proxy upload limits?44 comments · 2017-11-16#701Reverse Proxy not working30 comments · 2017-01-30#133nginx-proxy only sees docker's virtual interface (and IP)30 comments · 2015-03-26#1546SSL received a record that exceeded the maximum permissible length.28 comments · 2020-12-19#180page redirection from www to non-www28 comments · 2015-06-12#1642ERR_HTTP2_SERVER_REFUSED_STREAM with PHP web application on 0.9.026 comments · 2021-05-27#1204Redirect from http non-www to https www (single redirect)24 comments · 2018-11-29
Discussions
#27391.11.00 comments · 2026-05-26#2727Post-Quantum Cryptography (PQC) support for better security1 comments · 2026-04-18#2722Use host's SSL certificates1 comments · 2026-04-04#2708Multiplexing different protocols into 443 port0 comments · 2026-02-24#27051.10.00 comments · 2026-02-13#2691Use of hardened-images : dhi.io/nginx0 comments · 2026-01-03#2690Make username appears in logs for FreshRSS api0 comments · 2026-01-03#2688HTTPS_METHOD: no_redirect results in http to be rejected with 5031 comments · 2025-12-16
Latest release
1.11.6 1.11.6 2026-07-16What's Changed Dependencies build: bump library/nginx from 1.31.2 to 1.31.3 by @dependabot in https://github.com/nginx-proxy/nginx-proxy/pull/2768 Full Changelog: https://github.com/nginx-proxy/nginx-proxy/compare/1.11.5...1.11.6