Nginx Web server can achieve load balancing, but one Nginx is also limited. If the volume is not high, how to achieve load balancing on its upper layer. If it is DNS or CDN, building multiple computer rooms will inevitably lead to data synchronization problems in multiple computer rooms. Is there any good information on this?
Answer:
The information in this area is basically incomplete piece by piece. I will probably tell you a basic architecture: (Recommended learning: nginx tutorial)
DNS server, if there are sufficient funds, it is recommended to use a BGP computer room and 2-3 DNS servers For equalization, bind software is usually used. If funds are tight, you can purchase a professional DNS service, such as domestic dnspod.
CDN server, if you want to save trouble at the beginning, you can buy the services of a professional company, such as chinacache, but the cost will become higher and higher with development. If you build it yourself, you may build it separately, put servers in different computer rooms such as China Telecom, China Unicom, China Mobile, etc., and perform dynamic resolution through DNS. For very large websites, you can use Squid, for ordinary medium to large websites, use Nginx, and for internal use, use Varnish.
The front-end is balanced. If you have sufficient funds, you can use hardware equipment, hundreds of thousands of units. If you already have a technical team, you can use Nginx/Haproxy Keepalived to build your own front-end. The balancing methods are relatively flexible, including random, weight, IP, and URL.
The problem of synchronization depends on what is being synchronized. Normally, real-time file synchronization is possible. But for databases, the synchronization method depends on the specific type.
The back-end application server and database cluster depend on traffic planning.
There are several ways to achieve balance among multiple Nginx units:
1. Each Nginx unit has a public network address, and multiple directions to the same domain name are set at the domain name. , the simplest way to implement Lun Xun. But the fault cut-off will be slower.
2. One public network Nginx distributes to multiple nginx on the intranet through the upstream function, wheel, IP, and URL. But if nginx on the public network goes Down, the internal network will be completely disconnected.
3. A pair of public network Nginx plus three public network IPs, achieve high availability through Keepalive, and then upstream to the intranet.
4. A hardware balancing server is at the front end, and then the content is balanced to other servers through hardware.
The hypothesis you mentioned can be realized through methods 2, 3, and 4.
The above is the detailed content of How multiple nginx clusters work. For more information, please follow other related articles on the PHP Chinese website!

NGINXUnit can be used to deploy and manage applications in multiple languages. 1) Install NGINXUnit. 2) Configure it to run different types of applications such as Python and PHP. 3) Use its dynamic configuration function for application management. Through these steps, you can efficiently deploy and manage applications and improve project efficiency.

NGINX is more suitable for handling high concurrent connections, while Apache is more suitable for scenarios where complex configurations and module extensions are required. 1.NGINX is known for its high performance and low resource consumption, and is suitable for high concurrency. 2.Apache is known for its stability and rich module extensions, which are suitable for complex configuration needs.

NGINXUnit improves application flexibility and performance with its dynamic configuration and high-performance architecture. 1. Dynamic configuration allows the application configuration to be adjusted without restarting the server. 2. High performance is reflected in event-driven and non-blocking architectures and multi-process models, and can efficiently handle concurrent connections and utilize multi-core CPUs.

NGINX and Apache are both powerful web servers, each with unique advantages and disadvantages in terms of performance, scalability and efficiency. 1) NGINX performs well when handling static content and reverse proxying, suitable for high concurrency scenarios. 2) Apache performs better when processing dynamic content and is suitable for projects that require rich module support. The selection of a server should be decided based on project requirements and scenarios.

NGINX is suitable for handling high concurrent requests, while Apache is suitable for scenarios where complex configurations and functional extensions are required. 1.NGINX adopts an event-driven, non-blocking architecture, and is suitable for high concurrency environments. 2. Apache adopts process or thread model to provide a rich module ecosystem that is suitable for complex configuration needs.

NGINX can be used to improve website performance, security, and scalability. 1) As a reverse proxy and load balancer, NGINX can optimize back-end services and share traffic. 2) Through event-driven and asynchronous architecture, NGINX efficiently handles high concurrent connections. 3) Configuration files allow flexible definition of rules, such as static file service and load balancing. 4) Optimization suggestions include enabling Gzip compression, using cache and tuning the worker process.

NGINXUnit supports multiple programming languages and is implemented through modular design. 1. Loading language module: Load the corresponding module according to the configuration file. 2. Application startup: Execute application code when the calling language runs. 3. Request processing: forward the request to the application instance. 4. Response return: Return the processed response to the client.

NGINX and Apache have their own advantages and disadvantages and are suitable for different scenarios. 1.NGINX is suitable for high concurrency and low resource consumption scenarios. 2. Apache is suitable for scenarios where complex configurations and rich modules are required. By comparing their core features, performance differences, and best practices, you can help you choose the server software that best suits your needs.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Notepad++7.3.1
Easy-to-use and free code editor