Giter Club home page Giter Club logo

Test GitHub release nginx 1.25.4 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.5

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

Alpine based version (-alpine suffix)

This image is based on the nginx:alpine image.

docker pull nginxproxy/nginx-proxy:1.5-alpine

⚠️ 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.

nginx-proxy's Projects

nginx-proxy icon nginx-proxy

Automated nginx proxy for Docker containers using docker-gen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.