1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2024-11-21 19:36:30 +00:00
Go to file
Jason Wilder 941f3cc9d2 Merge pull request #35 from vegasbrianc/master
Added the updated Bash
2014-09-25 08:30:37 -06:00
Dockerfile Upgrade Bash 2014-09-25 12:59:36 +02:00
nginx.tmpl Support multiple VIRTUAL_HOSTs per container. 2014-06-08 10:14:51 -06:00
Procfile Only add source after dependency download 2014-09-17 20:23:27 +01:00
README.md Updated Readme Syntax 2014-09-05 01:34:49 +02: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 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  ...

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.

Multiple Hosts

If you need to support multipe virtual hosts for a container, you can separate each enty with commas. For example, foo.bar.com,baz.bar.com,bar.com and each host will be setup the same.