https://github.com/cuyu/nginx-lb
⚖ A docker image to start a load balancer (with sticky module) using Nginx
https://github.com/cuyu/nginx-lb
docker-image load-balancer nginx proxy
Last synced: about 2 months ago
JSON representation
⚖ A docker image to start a load balancer (with sticky module) using Nginx
- Host: GitHub
- URL: https://github.com/cuyu/nginx-lb
- Owner: cuyu
- License: mit
- Created: 2017-03-14T03:48:56.000Z (over 9 years ago)
- Default Branch: alpine
- Last Pushed: 2017-07-21T06:13:12.000Z (almost 9 years ago)
- Last Synced: 2025-02-23T23:16:24.575Z (over 1 year ago)
- Topics: docker-image, load-balancer, nginx, proxy
- Language: Shell
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## nginx-lb
A docker image to start a load balancer (with [sticky](https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng) module) using Nginx.
*Since we use the third-party module ([sticky](https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng)), 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).~~