Skip to content
/ nginx-lb Public

⚖ A docker image to start a load balancer (with sticky module) using Nginx

License

Notifications You must be signed in to change notification settings

cuyu/nginx-lb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx-lb

A docker image to start a load balancer (with sticky module) using Nginx.

Since we use the third-party module (sticky), the Nginx must be compiled from the source. To reduce the image size, we use alpine as basic image. The built image size is 194MB which is acceptable now.

Getting started

  1. Pull the docker image:

    docker pull cuyu/nginx-lb
    

    OR you can git clone this project and build the docker image at local:

    docker build -t nginx-lb .
    
  2. Create a file named hosts, with specific hostnames (include port) in it. For example:

    example-host1:8000
    example-host2:8000
    example-host3:8000
    
  3. Run the docker container:

    docker run --rm --name lb -v /YOUR_OWN_PATH/hosts:/usr/local/hosts -p 8080:80 cuyu/nginx-lb
    

    Then open http://localhost:8080, you will see the target web page.

    OR if you want to proxy with ssl:

    docker run --rm --name lb -v /YOUR_OWN_PATH/hosts:/usr/local/hosts -p 8080:80 cuyu/nginx-lb -ssl
    

    Then open https://localhost:8080, you will see the target web page.

TODO

  1. Support proxy https web pages (i.e. enable ssl).
  2. Use smaller base image (maybe install g++ and wget on a basic ubuntu image).

About

⚖ A docker image to start a load balancer (with sticky module) using Nginx

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published