In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to configure reverse proxy and load balancing in Nginx". The explanation in this article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "how to configure reverse proxy and load balancing in Nginx".
NGINX reverse proxy and load balancing are often used in the website architecture of a high concurrency, high availability solution, let's directly operate the actual operation, of course, the theory is also necessary.
I. reverse proxy
Process: reverse proxy: client 1 > proxy server for example: a (client) wants to rent a house, B (agent) rents the house to him. At this time, C (server) is actually the landlord. B (agent) is the intermediary who rented the house to A (client). In this process, A (client) does not know who the landlord of the house is, he may think that the house is the summary of B (agent): in the reverse proxy, the client does not know which server he wants to access, and the reverse proxy mode blocks or hides the real server information.
Structure diagram
1. What is a forward agent
Process: client agent 1 > server for example: a (client) wants to rent a house in C (server), but A (client) does not know that C (server) cannot rent it. B (agent) knows that C (server) can rent the house, so you asked B (agent) to help rent the house. Summary: forward proxy * * is characterized by the fact that the client is very clear about the server address to be accessed; the server only knows which proxy server the request comes from, but not which specific client; forward proxy mode shields or hides the real client information.
2. The difference between forward proxy and reverse proxy
3. Description of each parameter of reverse proxy
Second, load balancing
Note: the number of requests sent by the client and received by the nginx reverse proxy server is what we call the load, and the rule that the number of requests is distributed to different servers according to certain rules is a balancing rule, so the process of distributing requests received by the server according to the rules is called load balancing.
Schematic diagram
Load balancing scheduling algorithms supported by nginx: six strategies for Nginx load balancing
III. Actual combat operation
1. Environment
Proxy server (receive all requests) 192.168.8.146 server 1, 192.168.228 purl 8080 2, 192.168.228 purl 8081 3, 192.168.228 purl 808
1) proxy server
2) Server
Server No. 1 server {listen 8080; server_name www.common.com; root / www/local; charset utf-8; index index.php index.html index.htm; try_files $uri $uri/ / index.php?$query_string; location ~ .php ${fastcgi_pass 127.0.0.1 server_name www.common.com; root; server $document_root$fastcgi_script_name; include fastcgi_params;}} Server No. 2 server {listen 8081 Server_name www.common.com; root / www/test-common/common/public; charset utf-8; index index.php index.html index.htm; try_files $uri $uri/ / index.php?$query_string; location ~ .php ${fastcgi_pass 127.0.0.1 index.php?$query_string; location 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;} No. 3 server server {listen 8082 Server_name www.common.com; root / www/test; charset utf-8; index index.php index.html index.htm; try_files $uri $uri/ / index.php?$query_string; location ~ .php ${fastcgi_pass 127.0.0.1 virtual 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}}
2. Effect
Thank you for reading, the above is the content of "how to configure reverse proxy and load balancing in Nginx". After the study of this article, I believe you have a deeper understanding of how to configure reverse proxy and load balancing in Nginx. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.