01PARTCoreWebApi tutorial local demonstration environment Visual Studio2019---Vsersion:16.4.4+NetCore3.1.2 02PARTNginx quickly builds and configures load balancing Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server released under the BSD-like protocol. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx's concurrency capabilities perform better among web servers of the same type. Users of nginx websites in mainland China include: Baidu, JD.com, Sina, NetEase, Tencent, Taobao, etc. The following demonstrates the process of configuring Nginx 1. Download the Nginx package: http://nginx.org/en/download.html Note that the path for downloading and storing the Nginx package must be in English and cannot contain Chinese characters; 2. Start Nginx: Just double-click the downloaded Nginx package to open "nginx.exe", or you can start it through the command; the command start is not explained in detail here; after starting, open the task manager, and you will find that there will be Nginx service in the task manager; 3. At this time, you can use Nginx to configure load balancing. I first start multiple WebApi servers and run them. The data returned by the same interface of each server is slightly different. The data returned by the interface of the first server is: Chaoxi Education---1, the data returned by the interface of the second server is: Chaoxi Education---2, and the data returned by the interface of the third server is: Chaoxi Education---3. The ports of the three servers after startup are: 8011, 8022, and 8033 respectively. In other words, the 8011 port returns: Chaoxi Education---1; the 8022 port returns: Chaoxi Education---2; the 8033 port returns: Chaoxi Education---3. In other words, the three server codes are the same, but the results returned here are different, in order to be able to test the difference. 4. After startup, the debugging results are: http://127.0.0.1:8011/api/First returns: Chaoxi Education---1; http://127.0.0.1:8022/api/First returns: Chaoxi Education---2; http://127.0.0.1:8033/api/First returns: Chaoxi Education---3; Figure 1 Figure 2 Figure 3 5. The test shows that all three services have been started: At this time, I will configure three server Tonggu nginx clusters; configure the configuration files;
Modify the configuration file as follows: CMD executes the 6. Request the same address: http://127.0.0.1:8080/api/First three times and get three different results; Figure 1 Figure 2
Summarize This is the end of this article about WebApi deployment on multiple servers and Nginx load balancing configuration. For more information about WebApi deployment on multiple servers and Nginx load balancing configuration, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of the use of HTML canvas and page storage technology in JavaScript
>>: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'
Preface During the stress test, if the most direc...
The Docker container that has been running shows ...
About who Displays users logged into the system. ...
Preface When writing front-end pages, we often us...
Add rules to the el-form form: Define rules in da...
[LeetCode] 177.Nth Highest Salary Write a SQL que...
Find the problem I recently encountered a problem...
Table of contents 1 What is SSH 2 Configure SSH p...
Table of contents 1. What is copy_{to,from}_user(...
One of the most commonly used and discussed data ...
Usage scenario: We use Alibaba Cloud and purchase...
Vue uses Ref to get component instances across le...
Today I saw a little trick for HTML text escaping ...
Table of contents 1. Repeated declaration 1.1 var...
This article shares the specific code of Vue.js t...