Getting Started with NGINX Plus on Amazon EC2

Basic Installation

Getting started with NGINX Plus in the Amazon Elastic Compute Cloud (EC2) is easy! We provide multiple supported instances of NGINX Plus (based on Amazon Linux, RedHat 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’. The NGINX Plus on AWS whitepaper from AWS provides a detailed description.

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@ec2-54-86-83-172.compute-1.amazonaws.com
...
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 the open source NGINX product 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 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.

Cover image
Microservices: From Design to Deployment
The complete guide to microservices development