load balance
root@f86531f48431:/etc/nginx/conf.d# ls
default.origin load_balance.conf server1.conf server2.conf server3.conf
root@f86531f48431:/etc/nginx/conf.d# cat server1.conf
server {
listen 80;
server_name localhost;
location / {
root /home/html1;
index index.html;
}
location /srvc2 {
proxy_pass http://localhost:8002/;
}
location /srvc3 {
proxy_pass http://localhost:8003/;
}
location /srvc4 {
proxy_pass http://localhost:8004/;
}
error_page 404 400 401 /error4xx.html;
}
root@f86531f48431:/etc/nginx/conf.d# cat load_balance.conf
upstream services{
server localhost:8002;
server localhost:8003;
}
server {
listen 8004;
server_name localhost;
location / {
proxy_pass http://services;
}
}
root@f86531f48431:/etc/nginx/conf.d# cat server2.conf
server {
listen 8002;
server_name localhost;
location / {
root /home/html2;
index index.html;
}
}
root@f86531f48431:/etc/nginx/conf.d# cat server3.conf
server {
listen 8003;
server_name localhost;
location / {
root /home/html3;
index index.html;
}
}