1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-12-27 04:56:32 +00:00
Go to file
Jason Wilder a794d6db46 Remove embedded Dockerfile contents
It's added by index.docker.io automatically.
2014-05-20 09:40:38 -06:00
Dockerfile Improve port configuration 2014-05-19 21:10:53 -06:00
nginx.tmpl Improve port configuration 2014-05-19 21:10:53 -06:00
README.md Remove embedded Dockerfile contents 2014-05-20 09:40:38 -06:00
supervisor.conf Improve port configuration 2014-05-19 21:10:53 -06:00

nginx-proxy sets up a container running nginx and docker-gen. docker-gen generate reverse proxy configs for nginx and reloads nginx when containers they 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 -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock -t jwilder/nginx-proxy

Then start any containers you want proxied with an env var VIRTUAL_HOST=subdomain.youdomain.com

$ docker run -e VIRTUAL_HOST=foo.bar.com -t ...

Provided your DNS is setup to forward foo.bar.com to the a host running nginx-proxy, the request will be routed to a container with the VIRTUAL_HOST env var set.

Multiple Ports

If your container exposes multiple ports, nginx-proxy will default to the service running on port 80. If you need to specify a different port, you can set a VIRTUAL_PORT env var to select a different one. If your container only exposes one port and it has a VIRTUAL_HOST env var set, that port will be selected.