/
Configuring NGINX for Spinup Load Balancers
Configuring NGINX for Spinup Load Balancers
This guide explains a basic configuration of NGINX on your EC2 instance to serve traffic on ports 80 / 443.
Prerequisites
EC2 instance running Ubuntu, AlmaLinux, or Amazon Linux
Administrative (sudo) access
A web application, and the port it is hosted on (
YOUR_APP_PORT
)
Enable Firewall Access
Navigate to your Space in the Spinup portal
Open the Firewall tab
Add rules allowing traffic to ports 80 and 443.
Installation
Ubuntu
sudo apt update && sudo apt install nginx
AlmaLinux/Amazon Linux
sudo dnf install nginx
sudo setsebool -P httpd_can_network_connect 1
SSL Certificate Setup
Generate a self-signed certificate for backend HTTPS:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/nginx-selfsigned.key \
-out /etc/ssl/certs/nginx-selfsigned.crt
NGINX Configuration
Create /etc/nginx/conf.d/app.conf
:
Replace YOUR_APP_PORT
with your application's port number.
Enable and Start NGINX
Verification
Check that NGINX is running:
From a web browser, attempt to connect to http://YOUR_IP and https://YOUR_IP. If you see your web application, you are all set!