Simple load balancing using a nginx reverse proxy

Source: Internet
Author: User
Tags openssl web services nginx server nginx reverse proxy

Nginx the principle advantages of reverse proxy:

A reverse proxy can be simply understood to be a proxy server that receives a server request on the Internet, then forwards the request to the internal server, and then returns the result to the requesting client on the Internet, so the proxy server behaves as if it were only a single server. The reverse proxy server, also known as Web Server acceleration, provides acceleration for the Web server. He acts as a proxy server, not for browser users, but for one or more specific Web servers. You can cache Web pages, reduce the amount of Web server traffic, reduce the load on your Web server, and implement a reverse proxy, simply by placing the reverse proxy device on the front of one or more Web servers. When an Internet user accesses a Web server, the IP address that is resolved through the DNS server is the IP address of the proxy server, not the IP address of the original Web server, when the proxy Server device acts as a Web server, and the browser can connect to it without further connecting directly to the Web server. As a result, a large amount of Web service work is reproduced on the reverse proxy service. Not only can reduce the burden of the Web server to a large extent, improve the speed of access, but also to prevent the external network host direct and direct communication with the Web server to bring security risks.

Nginx Proxy is the trump card function of Nginx, using proxy can basically achieve a complete 7-layer load balancing, it has these characteristics:

1. Powerful function, excellent performance and stable operation.

2. Simple and flexible configuration.

3. Can automatically eliminate the work of the back-end server is not normal.

4. Upload files using asynchronous mode.

5. Support a variety of allocation strategies, you can assign weights, flexible distribution mode

Project topology:

Configuration environment:

Three centos6.2x86 1 do nginx proxy 2 Apache to do the page test server

Configuration steps:

Solve the dependency problem first before installing the Pcre-devel OpenSSL zlib-devel

First, install Nginx server

1. Web Services in the background we are using the Apache service, about the installation of Apache deployment we do not do in detail here, our focus in the direction of Nginx agent how to configure.

2. Installation of Nginx Service

Yum-y Install make 
     
   yum-y install pcre pcre-devel openssl-devel zlib-devel gcc gcc-c++ 
     
   mkdir/usr/local/site/ngin X-p 
     
   useradd-s/sbin/nologin www 
     
   rpm-qa | grep httpd 
     
   ./configure--prefix=/usr/local/site/nginx/--user= www--group=www  \ Specifies nginx user group 
     
--with-http_stub_status_module  \  Non-core module to obtain the status of Nginx from the last time it was opened 
     
With-http_ssl_module    turn on SSL module make 
     
  && make install

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.