简体   繁体   中英

How can I create Nginx IIS LoadBalancer by using Powershell over Octopus?

How can I create Nginx load balancer with IIS? This question is not easy to describe for me. So I separated 2 phases about my problem.

1)there is 1 Nginx server(app.xyz.com) infront of IIS Websites (app1.xyz.com,app2.xyz.com,app3.xyz.com ) All requests are sent to app.xyz.com because it is a load balancer. Is it easy to do that? How can I do that by using Octopus with powershell.

2) I have to stop app1.xyz.com by deploying while app2.xyz.com and app3.xyz.co. working.

When

 app1.xyz.com (DOWN)    app1.xyz.com (UP)     app1.xyz.com (UP)
 app1.xyz.com (UP)      app1.xyz.com (DOWN)   app1.xyz.com (UP)
 app1.xyz.com (UP)      app1.xyz.com (UP)     app1.xyz.com (DOWN)

step by step deploying without stopping all web apps. Please look at below pictures What I draw:

在此处输入图片说明

在此处输入图片说明

nginx.conf:


worker_processes  4;

events {
    worker_connections  1024;
}


http {
    client_max_body_size 100M;
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;


 upstream loadbalancer.xyz.com {
    server staging1.xyz.com:996;
    server staging2.xyz.com:997;
    keepalive 15;
  }

server {
    listen 999;

    location / {


      proxy_pass https://loadbalancer.xyz.com;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
    }

  }
}

If you aren't completely sold on using nginx for the load balancer i've done the same thing you are describing with using IIS as a proxy / load balancer which routes to the application IIS servers behind it. You can then use windows network load balancer to make your proxy / load balancers for your proxies (assuming you make more than 1) for high availability too if you desire. If that is something you are interested in I can help you out with that but using nginx i'm not the best with for load balancers. I'd comment but i'm new to stack overflow... Sorry...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM