Home Backend Development PHP Tutorial Balancing load of nginx and IIS

Balancing load of nginx and IIS

Jul 29, 2016 am 09:15 AM
nbsp nginx server windows

If you have paid attention to nginx, you must know what the nginx software is used for. If the number of visits to your website is getting higher and higher, and one server can no longer bear the traffic pressure, then add a few more servers to handle the load. You can buy hardware equipment to load the website, such as F5, but the price is hundreds of thousands to millions, which is expensive enough. This article introduces the software to load the website is free, and nginx is currently used by many portals and websites with high traffic volume. I am using nginx as an HTTP server, so nginx is very good. Let’s introduce the load test below.
Environment:
(2 servers)
First server:
CPU: Inter(R) Pentium(R) 4 CPU 2.8G
Memory: 1G
System: windows 7
IIS: IIS 7
nginx: nginx/Windows- 0.8.22
IP: 172.10.1.97
Environment: Local
Second unit:
CPU:Inter(R) Pentium(R) 4 CPU 3.0G
Memory: 2G
System: windows Server 2003
IIS: IIS 6
IP : 172.10.1.236
Environment: Remote

Description:
For this test, the software nginx is placed locally (172.10.1.97), which means it is placed on the server where the domain name is bound. The IIS of this server cannot use port 80 , because the nginx software will use port 80 later.
The address to download nginx is as follows:
nginx download: http://nginx.net/
Download the version used in this test: nginx/Windows-0.8.22

Download and extract to C:, change the directory name to nginx

Okay, let’s get into practice:

First:

Create a website on the local server IIS (172.10.1.97), using port 808, as shown below:

Second:

On the remote 172.10.1.236 IIS creates a website, using port 80, as shown below:

Third:

Okay, the above has set up the IIS of the two servers, let’s configure the nginx software to achieve website load balancing, open the following file:

C:nginxconfnginx.conf

1. Find the content server {

Add the following content here:

upstream xueit.com {
server 172.10.1.97:808;
server 172.10.1.236:80;
}

(This is the server website IP used for load switching)

2. Find location / {
                                                                                                                                    ​proxy_pass http ://xueit.com/;
             proxy_redirect default;
Listen 80;

server_name 172.10.1.97 ;

(This is to monitor the request to access port 80 of the server bound to the domain name)


Okay, it is so simple to configure it here. Let’s take a look at the above 3-step configuration diagram:

Fourth:

It’s all configured, let’s start the nginx software

Enter the command prompt CMD, enter c:nginx>, enter the nginx command, as shown below:

At this time, the system process has two nginx.exe processes, as shown below:运 Stop Nginx Run input Nginx -S STOP to

Fifth:

After the above configuration, we now see the load effect: Local (172.10.1.97) This server opens IE, IE, Input: http://172.10.1.97/

The result of opening the website for the first time:

Refresh the web page again, and the result image that appears:


Very good, the website has been loaded successfully. After this test, it is no longer difficult to achieve website load. There is no need to buy very expensive hardware equipment. Online introductions say that nginx software can handle tens of thousands of concurrent requests, so it is definitely a very good choice.

If the website visits are very large, you can use one server to run nginx, and other servers to run the website program (the programs of several servers are the same), so that the load will not be a big problem. If it still doesn't work, put some of the website The column is a second-level domain name, and the second-level domain name is also loaded. This is even more powerful.

The performance of nginx software running on Linux is better than running on Windows, so you can use Linux to run nginx for load, and the website developed by .net is placed on the Windows server IIS.


The above introduces the balanced load of nginx and IIS, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to start nginx server How to start nginx server Apr 14, 2025 pm 12:27 PM

Starting an Nginx server requires different steps according to different operating systems: Linux/Unix system: Install the Nginx package (for example, using apt-get or yum). Use systemctl to start an Nginx service (for example, sudo systemctl start nginx). Windows system: Download and install Windows binary files. Start Nginx using the nginx.exe executable (for example, nginx.exe -c conf\nginx.conf). No matter which operating system you use, you can access the server IP

How to check the name of the docker container How to check the name of the docker container Apr 15, 2025 pm 12:21 PM

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to check whether nginx is started How to check whether nginx is started Apr 14, 2025 pm 01:03 PM

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

How to configure nginx in Windows How to configure nginx in Windows Apr 14, 2025 pm 12:57 PM

How to configure Nginx in Windows? Install Nginx and create a virtual host configuration. Modify the main configuration file and include the virtual host configuration. Start or reload Nginx. Test the configuration and view the website. Selectively enable SSL and configure SSL certificates. Selectively set the firewall to allow port 80 and 443 traffic.

Can vs code run in Windows 8 Can vs code run in Windows 8 Apr 15, 2025 pm 07:24 PM

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

How to run nginx apache How to run nginx apache Apr 14, 2025 pm 12:33 PM

To get Nginx to run Apache, you need to: 1. Install Nginx and Apache; 2. Configure the Nginx agent; 3. Start Nginx and Apache; 4. Test the configuration to ensure that you can see Apache content after accessing the domain name. In addition, you need to pay attention to other matters such as port number matching, virtual host configuration, and SSL/TLS settings.

How to create a mirror in docker How to create a mirror in docker Apr 15, 2025 am 11:27 AM

Steps to create a Docker image: Write a Dockerfile that contains the build instructions. Build the image in the terminal, using the docker build command. Tag the image and assign names and tags using the docker tag command.

How to start containers by docker How to start containers by docker Apr 15, 2025 pm 12:27 PM

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

See all articles