Web Server Load Balancing with NGINX Plus

Basic Installation

Getting started with NGINX Plus in the Amazon Elastic Compute Cloud (EC2) is easy! We provide supported instances of NGINX Plus for several operating systems (including Amazon Linux, CentOS, Red Hat Enterprise Linux, and Ubuntu) at the Amazon Web Services (AWS) Marketplace, both available either as a free trial or on a pay‑by‑use basis.

Amazon’s Getting Started guide gives you a quick introduction to the process of launching AMI instances, though it’s really as simple as ‘Subscribe’ and ‘Launch’. For a detailed description, see NGINX Plus on the AWS Cloud.

When you launch a new instance, NGINX Plus starts automatically and is configured to serve a default index.html page. Use the control panel to determine the public DNS name for the instance and access it using a web browser:

Screenshot of the default index.html page for an NGINX Plus AMI on Amazon EC2

Troubleshooting – Security Groups

If the connection times out and you don’t see the default web page, it’s most likely that the EC2 security group that was assigned to the instance does not permit HTTP traffic. You can create a new security group that admits HTTP (port 80) and HTTPS (port 443) traffic from all sources, and locks down SSH so it’s only accessible from your IP address:

Screenshot of the 'Create Security Group' screen with settings that admit HTTP and HTTPS traffic to an NGINX Plus AMI on Amazon EC2

Now apply the group to your NGINX Plus instance:

Screenshot of the 'Change Security Groups' screen showing how to apply a security group to an NGINX Plus AMI on Amazon EC2 and admit HTTP and HTTPS traffic

Checking the Status of the Running Instance

Now, connect to the instance using SSH and check the status of NGINX Plus:

user@localhost$ chmod 400 aws_cert.pem
user@localhost$ ssh -i aws_cert.pem
ubuntu@ip-192-168-20-254:~$ /etc/init.d/nginx status
 * nginx is running

Installing Additional NGINX Plus modules

The AMIs are preinstalled with the standard nginx-plus package. It includes the core modules from NGINX Open Source and a number of extensions to improve load balancing, media delivery, caching, and management.

The source code for NGINX Plus is not available. If you want to use some of the more popular third‑party modules with NGINX Plus, they can be installed from our modules repository.

Your NGINX Plus support contract covers only the functionality created and certified by NGINX, Inc. Some third‑party modules are provided for convenience, and are not covered by NGINX support.

Enabling High Availability

NGINX Plus with Amazon ELB

ELB functions as a Layer 7 HTTP proxy (much like NGINX Plus). If you want to determine the true source IP address of a client connection that is forwarded to NGINX Plus, you can inspect the X-Forwarded-For header that is added by ELB, using the Real IP module in NGINX Plus.

If you plan to deliver applications over HTTP/2 or using WebSocket, then you need to know that ELB does not terminate HTTP/2 traffic or forward WebSocket connections. In this case, you need to configure ELB to perform TCP load balancing (rather than HTTP/HTTPS) and use the PROXY Protocol to forward source IP addresses.

Editor – The previous paragraph originally referred to SPDY, which was the technology available at the time of publication and formed the basis for HTTP/2.

For instructions on configuring high availability for NGINX Plus in AWS, see our deployment guides.

For more information, see NGINX Plus and Amazon Elastic Load Balancing on AWS.

NGINX Plus with Route 53

Our deployment guide, Global Server Load Balancing with Amazon Route 53 and NGINX Plus, explains step‑by‑step how to configure all components – Route 53 for GSLB, NGINX Plus to load balance traffic in each region, and NGINX or NGINX Plus to serve domain content from the regions.

Hero image
《NGINX 完全指南》2024 年最新完整版



Owen Garrett


Owen is a senior member of the NGINX Product Management team, covering open source and commercial NGINX products. He holds a particular responsibility for microservices and Kubernetes‑centric solutions. He’s constantly amazed by the ingenuity of NGINX users and still learns of new ways to use NGINX with every discussion.


F5, Inc. 是备受欢迎的开源软件 NGINX 背后的商业公司。我们为现代应用的开发和交付提供一整套技术。我们的联合解决方案弥合了 NetOps 和 DevOps 之间的横沟,提供从代码到用户的多云应用服务。访问 了解更多相关信息。