Click on “Road of Technology for Migrant workers” and choose “Top or Star label”

10 o ‘clock every day for you to share different dry goods

Love beauty, love joy

Nginx is probably the hottest Web and reverse proxy server out there right now.

Nginx configuration Generator: Powerful! Nginx configuration online one-click generation “artifact”

How does Nginx start and process HTTP requests?

Nginx dynamic version upgrade: smooth upgrade and rollback of Nginx version in 1 minute

It is a high-performance Web server from Russia that performs better than Apache, especially in high concurrency situations. What other uses does it have besides load balancing? Let’s take a look.

Static proxy

Nginx is good at handling static files and is a great image and file server. By putting all static resources on Nginx, applications can be static and static and perform better.

Second, load balancing

Through reverse proxy, Nginx can realize load balancing of services, avoid single node failure of the server, and forward requests to different servers according to certain policies to achieve load effect. Common load balancing policies include:

1, polling

Requests are distributed to back-end servers in a sequential rotation that treats each server on the back-end equally, regardless of the actual number of connections to the server and the current system load.

2. Weighted polling

Different back-end servers may not have the same machine configuration and load on the current system, so they may not have the same ability to withstand stress. Assign higher weights to machines with high configuration and low load to handle more requests; Weighted polling works well for low-configuration, high-load machines by assigning them a lower weight, reducing their system load, and ordering and weighting requests to the back end.

3. Ip_hash

According to the IP address of the client, a value is calculated through the hash function, and the size of the server list is modulo calculated with this value. The result is the serial number of the server to be accessed by the client. The source address hash method is used for load balancing. When the list of back-end servers remains unchanged, clients with the same IP address will be mapped to the same back-end server each time for access.

4, random

Through the random algorithm of the system, a server is randomly selected for access according to the size of the list of back-end servers.

5. Least_conn (Minimum connection number Method)

Due to the backend server configuration is not the same, have fast or slow to request processing, the minimum number of connections method based on the current back-end server connection, dynamically select the current backlog connections at least one server to deal with the current request, improve the utilization efficiency of the back-end service as much as possible, will be responsible for properly to each server.

Three, the current limit

The current limiting module of Nginx is based on the leak-bucket algorithm, which is very practical in high concurrency scenarios.

1. Set parameters

1) Limit_REq_zone is defined in the HTTP block, where $binary_remote_addr means to save the binary form of the client IP address.

2) Zone The shared memory area that defines the IP status and URL access frequency. Zone =keyword Identifies the name of the region, followed by a colon, and the size of the region. The state information for 16000 IP addresses is about 1MB, so the zone in the example can store 160,000 IP addresses.

3) Rate Defines the maximum request Rate. The rate in the example cannot exceed 100 requests per second.

2. Set current limiting

Burst queue size, nodelay does not limit the time between individual requests.

Four, caching,

1, browser cache, static resource cache with expire.

Proxy layer cache


V. Black and white lists

1. Unlimited stream whitelist

2. Blacklist

Nginx: Static separation, load balancing, traffic limiting, caching, blacklists, etc.

The original link: https://m.toutiaocdn.com/i6692127248272589315

Yesterday’s book activity [do not drop pit, do not carry the pot! The history of the most complete server security management specifications open source (there are eggs)] continue to ~~~~~~, pay close attention to participate in it.

Public account back to “road to God” to get all the content

– MORE excellent articles – |

  • Don’t fall, don’t take the blame! The most comprehensive server security specification ever

  • Just yesterday, I dragged my boss into THE WC and gave zou a beating…..

  • 10 simple Tips to Become a Linux Pro fast!

  • Powerful! Nginx configuration online one-click generation “artifact”

  • Are there any common ways to hack Linux that you don’t know about?

  • 20 minutes with Ansible Tutorial!

Long press the TWO-DIMENSIONAL code to pay attention to the technical road of migrant workers

Scan code to pay attention to the public number, reply to the “directory” can view the public number of articles catalog, reply to the “group” can join the reader technical exchange group, communicate with you together.

——————————-

Thank you for reading. Here is a lucky draw link. Click the link to enter the lucky draw.

Thank you for reading, watching and forwarding all the time, click on me to participate in the lucky draw! Click on me to enter the draw!

All the best of the official account is here

You are watching, click here to have a surprise oh ~