0% found this document useful (0 votes)
168 views3 pages

NGINX Plus As A Load Balancer

NGINX Plus can be used as a load balancer on Ubuntu. The document provides instructions to install NGINX Plus and configure it to proxy HTTP requests to a backend server group. Key steps include: 1. Creating directories and downloading certificates for the NGINX Plus repository 2. Installing apt-utils and adding the NGINX Plus repository 3. Updating repositories and installing NGINX Plus 4. Defining an upstream group of backend servers 5. Configuring a proxy pass to route requests to the backend group

Uploaded by

Gurdarshan Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views3 pages

NGINX Plus As A Load Balancer

NGINX Plus can be used as a load balancer on Ubuntu. The document provides instructions to install NGINX Plus and configure it to proxy HTTP requests to a backend server group. Key steps include: 1. Creating directories and downloading certificates for the NGINX Plus repository 2. Installing apt-utils and adding the NGINX Plus repository 3. Updating repositories and installing NGINX Plus 4. Defining an upstream group of backend servers 5. Configuring a proxy pass to route requests to the backend group

Uploaded by

Gurdarshan Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

NGINX Plus as a Load Balancer

Installing NGINX Plus on Ubuntu


To install NGINX Plus on Ubuntu:

Create the /etc/ssl/nginx directory:

$ sudo mkdir /etc/ssl/nginx

$ cd /etc/ssl/nginx

Log in to NGINX Plus Customer Portal and download your nginx-repo.crt and nginx-repo.key files.

Copy the files to the /etc/ssl/nginx/ directory:

$ sudo cp nginx-repo.crt /etc/ssl/nginx/

$ sudo cp nginx-repo.key /etc/ssl/nginx/

Download the NGINX signing key from nginx.org and add it:

$ sudo wget https://nginx.org/keys/nginx_signing.key

$ sudo apt-key add nginx_signing.key

Install the apt-utils package and the NGINX Plus repository.

$ sudo apt-get install apt-transport-https lsb-release ca-certificates

$ printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" | sudo tee


/etc/apt/sources.list.d/nginx-plus.list

Download the 90nginx file to /etc/apt/apt.conf.d:

$ sudo wget -q -O /etc/apt/apt.conf.d/90nginx https://cs.nginx.com/static/files/90nginx

Update the repository information:

$ sudo apt-get update


Install the nginx-plus package. Any older NGINX Plus package is automatically replaced.

$ sudo apt-get install -y nginx-plus

HTTP Load Balancing

Proxying HTTP Traffic to a Group of Servers


Before start using Nginx Plus to load balance HTTP traffic to a group of servers, first, we need to
define the group with the upstream directive. The directive is placed in the http context.

Servers in the group are configured using the server directive. Let's see an example, the
following configuration defines a group named backend and consists of three server
configurations that may resolve in more than three actual servers.

http {  

    upstream backend {  

     server backend1.example.com ;  

 server backend2.example.com;  

         server 192.0.0.1 backup;  

     }  

}  

To pass the requests to a server group, the group name is specified in the proxy_pass directive. In the
below example, a virtual server running on Nginx passes all requests to the upstream backend group.

server {  

    location / {  

proxy_pass http://backend;  

    }  

}  
The following example combines the two snippets above and shows how to proxy HTTP request
to the backend server group. The group consists of three servers, two of the instances of the
same application while the third is a backup server. Because there is no load-balancing
algorithm is specified in the upstream block, Nginx uses the default algorithm, Round Robin.

http {  
    upstream backend {  
        server backend1.example.com;  
        server backend2.example.com;  
        server 192.0.0.1 backup;  
    }  
      
    server {  
        location / {  
            proxy_pass http://backend;  
        }  
    }  

Now NGINX Plus is ready to load balance the traffic. Please test and let me know if you stuck at
any point.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy