The CentOS system builds nginx load Balancer

Source: Internet
Author: User
Tags nginx server

First, about the CentOS system introduction

CentOS (Community Enterprise Operating System, Chinese means: Community Enterprise operating system) is one of the Linux distributions, it comes from Red Hat enterprise Linux is compiled according to the source code released by the open source rules. Based on Red Hat's continuous upgrade, and fixes for known bugs, CentOS is more used to build large enterprise-class servers. At present the newer version is 7.0, this article uses the CentOS7 64bit to build the system load balanced.

Ii. Installation of VMware

VMWare Ware is a "Virtual PC" software company. Its products allow you to run two or more windows, DOS, and Linux systems on a single machine. VMware uses a completely different concept than a "multi-boot" system. A multi-boot system can only run one system at a time, and the machine needs to be restarted when the system switches. This article installs the CentOS operating system using VMware WorkStation12. Detailed installation Step reference: View, Baidu software download click.

Iii. installation of the CentOS system

First you need to download the CentOS installer, download the iOS format, this article uses CentOS7 64bit version, download

Detailed installation steps please click to view

Precautions:

1. When partitioning, select EXT4 format, boot partition for 400m,/partition for 8g,/home partition for 7g,var partition for 6G,SWAP partition for 2G

2, user and group ID, all set to 1000

3, after the installation completed restart prompt license, input: 1, 2, R, yes completed enter the system successfully entered

4, Ctrl+alt mouse back to the computer, not in the virtual machine

Iv. installation of Nginx and configuration

1, Nginx Introduction

Nginx is a lightweight Web server/reverse proxy server and e-mail (IMAP/POP3) proxy server that is released under a bsd-like protocol. Igor Sysoev, a Russian engineer, was developed for use by large Russian import sites rambler. It is characterized by the possession of less memory, concurrency is strong, in fact, nginx concurrency is actually in the same type of Web server performance better.

2. Installation and Deployment

Install the Nginx server in CentOS7 via the command line.

(1) Add Nginx storage, add Epel repository

sudo yum install epel-release

(2) Check if Nginx has been installed

Find-name Nginx

(3) If there is an installation then delete

Yum Remove Nginx

(4) Installing Nginx

sudo yum install Nginx

(5) Start Nginx

sudo systemctl start Nginxsudo systemctl enable Nginx #可用

(6) Set Nginx to start the system automatically start Nginx

echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local

(7) View the native IP for subsequent configuration of nginx.conf

Ifconfig

(8) Modify the nginx.conf configuration file

cd/etc/nginx/#定位到nginx安装目录vim nginx.conf #通过vim打开nginx. conf configuration file

(9) The main configuration node, 192.168.119.1:8081 and 192.168.119.1:8082 are deployed in the IIS7 of the two ASP. NET MVC development sites (on another computer), design a software architecture solution follow-up.

Upstream 192.168.119.128{    server 192.168.119.1:8081;    Server 192.168.119.1:8082;} server{    listen   ;    server_name  192.168.119.128;    Location/{        proxy_pass   http://192.168.119.128;    }    }

(10) Restart Nginx Service

Service Nginx Restart

The above records are recorded in the CentOS7 operating system to build an nginx load balancer solution. Follow-up introduction through keepalived to build nginx load high-availability solution.

CentOS System build nginx Load Balancer

Related Article

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.