Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 1.63 KB

README.md

File metadata and controls

24 lines (18 loc) · 1.63 KB

web-proxy sets up a container running nginx, and generate reverse proxy configs for nginx and reloads nginx when containers are started and stopped. requests accessed to this container is distributed by the url location. this is inpired by jwilder/nginx-proxy.

Build Status

Usage

To run it:

$ docker run -d -p 80:80 -p 443:443 -v /var/run/docker.sock:/tmp/docker.sock kinoko/web-proxy

Then start any containers you want proxied with env vars WEB_VIRTUAL_HOST=example.com, WEB_LOCATION=/subloc, and WEB_PORT=3000

$ docker run -e WEB_HOST="example.com" -e WEB_LOCATION="/subloc" -e WEB_PORT="3000" --name test-web-page ...

This case the proxied container can be accessed with http://example.com/subloc. The variable WEB_PORT specifies the external port of the container. WEB_PORT=80 by the default.

HTTPS Certification

If you want proxied with https connection, you need to put *.crt and *.key files on the directry /etc/nginx/certs. The certification files are named by domain as example.com.crt or example.com.key.

Domain Specific nginx Configuration

If you have additional configurations for some specific domain, putting a file on /etc/nginx/vhost.d with domain name, e.g., example.com, will automatically include the content of the file into the nginx configuration of the specified domain.

Basic Authentication

If you want to authenticate some location on some domain, you need to put a htpasswd file on the directry /etc/nginx/htpasswd. The file is named by the container name as test-web-page.