Linux+asp.net Core+nginx Four-layer load balancing

Source: Internet
Author: User

Linux Disibutaion:ubuntu 16.04.1 LTS

Web Server:nginx, Kestrel

about how to deploy ASP. NET core in Linux I'm not in the details here, so you can refer to ASP. Run on Linux (Ubuntu)
Here I need three VMS:
NGINXVM01: Doing a Load balancer server
NGINXVM02: Service Node 1
NGINXVM03: Service Node 2
Approximate service architectures such as:

Configure the Load Balancer node (NGINXVM01):

sudo apt-get install-y nginxsudo touch/etc/nginx/sites-available/nginxlb-proxysudo vi/etc/nginx/sites-available/ Nginxlb-proxy

Nginx site configuration files are in the/etc/nginx/sites-available directory.

The active Web site is in the/etc/nginx/sites-enabled directory.

Nginx configuration Files Reference configuration file Structure in the Nginx guide

Write the contents to the Nginxlb-proxy file:

Upstream nginxlb{        server nginxservice.cloudapp.net:8082;        Server nginxservice.cloudapp.net:8083;} server {          listen 8081 default_server;        server_name nginxservice.cloudapp.net;        Location/        {                proxy_pass http://nginxlb;                Proxy_set_header x-real-ip $remote _addr;                Proxy_next_upstream Error timeout Invalid_header http_500 http_502 http_503;        }

There are multiple modes for load balancing using Nginx, refer to official website using Nginx as HTTP load balancer

I have tested the various load modes of nginx.

Reboot loading Nginx configuration file

sudo nginx-tsudo nginx-s Reload

To this step, nginx default enabled sites are the defaults, we need to change the enabled site to Nginxlb-proxy

sudo ln-s/etc/nginx/sites-available/nginxlb-proxy/etc/nginx/sites-enabled/  #删除默认启用的站点defaultsudo rm/etc/ Nginx/sites-enabled/default  

  

Service node ASP. NET Core Site deployment steps, refer to the previous blog.

Linux+asp.net Core+nginx Four-layer load balancing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.