Skip to content
www.mytechnote.ru
Menu
  • Administration
    • Scripts
  • Equipment
    • Reviews
    • Instructions
  • Other
  • English
    • English
    • Русский
Menu

Creating an IIS cluster with load balancing with nginx

Good afternoon, below will be told how to create a failover cluster with load balancing. We will balance the load with nginx, because IIS ARR 1) requires add. License for Windows, 2) can not monitor the http responses of several sites.

Let’s get started.

First, I’ll install the IIS itself, 2 pieces (you can have more =)). This procedure will not show here everything is clear-understand, go to the server manager, add the role of the web server to our servers.

In the meantime, while IIS is going to share 2 folders on some server (preferably not on where our web servers are). 1 folder for storing the configuration of IIS, the second for storing sites.

 

Next we need to install addhelper on both servers, you can download here.

It is needed to ensure that the correct IP addresses of site visitors are written in the IIS header, otherwise the address of the balancer will always be.

Next, after both iis installed, copy (if you need a default site) the contents of the folder c:\inetpub\wwwroot in our shared folder for sites (not forgetting to create a folder for the default site in it)

After that, we go to the IIS management console, go to the default site, go to the main settings and register our network path to the site.

Then click on our server and go to the general configuration, click on the export configuration, specify the network path to the shared folder where the IIS configuration will be located, and enter the password for the encryption keys. Click OK.

Next, we use the common configuration, enter the address of the location where our configuration is, click on apply and enter our password.

Next, you need to register the user on behalf of which the application pools are started, and who has access to our network folders. To do this, you need to log in to the authentication, and change the anonymous authentication. You can put a check by the application pool, or select a domain user.

Further we try to open our site if it was opened it is possible to continue, if not, then something is done wrong.

We pass to our second server. We do not forget to put ARRhelper, and we connect the common configuration, similarly as we did with the first server.

For ease of testing, you can fill in the following unpretentious asp page on the site – /sites/default/files/files/default.aspx, it shows the server address, client address and site name.

The IIS configuration is completed, now go on to configuring nginx. I bet on ubuntu, you can bet on anything, it does not matter.

Actually put nginx – sudo apt-get install nginx

After the installation of the rule config – sudo nano/etc/nginx/sites-enabled/default

My config is like this:

#Our web servers
    upstream web_servers {
        server 192.168.0.11;
        server 192.168.0.12;
        }
 #<span class="short_text" id="result_box" lang="en"><span>Which port to listen</span></span>
    server {
        listen 80;
        location / {
                #<span class="short_text" id="result_box" lang="en"><span>Proxy</span></span>
                proxy_pass http://web_servers;
                #<span class="short_text" id="result_box" lang="en"><span>Installation of the header</span></span>
                proxy_set_header X-proxy 192.168.0.13;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                #<span class="short_text" id="result_box" lang="en"><span>From this header arrhelper takes ip</span></span>
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                #<span id="result_box" lang="en"><span>Setting errors that nginx will try to access on the next server</span></span>
                proxy_next_upstream     error timeout invalid_header http_500 http_404;
                proxy_set_header X-Client-IP $remote_addr;
                }
        }

Restart nginx – sudo /etc/init.d/nginx restart If you have not issued any errors, then everything should work.

At this, for now, it’s all, you can try to register your nginx address in the DNS for your site and go to the site, you will see that the requests come to different servers (in this case, by default, balancing is round robin, nginx also has hash etc) ..

You can also watch the video instruction (it is on Russian Language):

Posted on 02.07.201730.05.2024 by sanglyb

Post navigation

← Setting up OTRS 3.1 (responses to requests, display in a digest)
Overview of the USB 3.0 controller VIA VL800 (VL805) →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Подписывайтесь

Youtube
vk
telegram
github
twitter
rss
  • Форум
  • Об авторе
  • Поддержать автора

Популярные записи

Новые записи

  • How to Extend an LVM Partition in Linux
  • SCCM Reporting Errors After Migrating from SQL Server 2016 to 2019
  • Problem Using PassFiltEx on Older CPUs
  • How to remove attachments from old calendar events in Exchange using a script
  • How to download and install Office 2024 LTSC

Архивы

  • 2026 (3)
  • 2025 (5)
  • 2024 (7)
  • 2023 (30)
  • 2022 (4)
  • 2020 (17)
  • 2017 (82)
  • 2016 (5)
© 2015-2026 www.mytechnote.ru
Использование материалов сайта возможно только с разрешения владельца или обязательна индексируемая, прямая, передающая вес ссылка на материал.