Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does nginx achieve load balancing?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following brings you how nginx achieves load balancing. I hope it can give you some help in practical application. Load balancing involves a lot of things, and there are not many theories. There are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.

1. Modify the nginx.conf configuration file by adding the following configuration upstream nginx {server 192.168.2.140 upstream nginx 8080; server 192.168.2.136 upstream nginx 8080;} in the http curly braces

two。 Modify the configuration location / {proxy_pass # in the location of server. The nginx here is the nginx after the above upstream. This is a name. Please save the two # places that are the same auth_basic off; auth_basic_user_file / var/user; root html; index index.html index.htm;}.

3. Prepare two CVMs with addresses of 192.168.2.140 and 192.168.2.136, and install apache servers with port 8080

4. Modify the index.jsp in apache webapps/ROOT to something simple.

Tomcat1 tomcat2

5. You can see the configured results when the browser accesses http://www.nginx1.com/. Each refresh requests a different apache service.

After reading the above about how nginx achieves load balancing, if there is anything else you need to know, you can find out what you are interested in in the industry information or find our professional and technical engineers who have more than ten years of experience in the industry.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report