# AWS # Next.js # DevOps # Nginx
Deploying Next.js on AWS EC2 with Nginx & SSL
Dec 05, 2024 8 min readBy Rohit Singh
Introduction
Deploying a Next.js application on a traditional VPS like AWS EC2 gives you full control over the infrastructure. In this guide, we'll walk through setting up an Ubuntu instance, installing Node.js, and using PM2 for process management.
Prerequisites
- An AWS Account
- Basic knowledge of SSH
- A Next.js project
Step 1: Launching an EC2 Instance
Go to your AWS Console, select EC2, and launch a generic Ubuntu 22.04 LTS instance. Ensure you allow traffic on ports 80 (HTTP), 443 (HTTPS), and 22 (SSH).
Step 2: Environment Setup
SSH into your instance and update the package lists:
sudo apt update && sudo apt upgrade -y
Then install Node.js and NPM using NVM (Node Version Manager) for flexibility.
Step 3: Configuring Nginx
Nginx acts as a reverse proxy, forwarding requests from port 80 to your Next.js app running on port 3000. Here is a basic configuration block...
You might also like...
Check out other articles on system design and cloud engineering.
Browse All Articles