This content originally appeared on DEV Community and was authored by MustafaSamedYeyin
If you want to load balance request from nginx you can use upstreams.
I have one application in ubuntu machine :
- And one from windows machine :
They are just plain static files serves on 8080 port.
I will upstream for load balancing for above two application :
upstream my_upstream {
server 172.30.16.1:8080 weight=5;
server 192.168.137.133:8080 weight=4;
}
server {
listen 80;
location / {
proxy_pass http://my_upstream;
}
}
- You should start nginx.exe .
- Send request to :
- When you sent request over and over again, you will see there is some kind of balanced handling (depends on weight paramater):
Happy serving
This content originally appeared on DEV Community and was authored by MustafaSamedYeyin