How I Host Multiple Node.js Applications on a Single AWS Lightsail Server

Published: (June 12, 2026 at 08:01 AM EDT)
2 min read
Source: Dev.to

Source: Dev.to

A few years ago, whenever I started a new project, I thought: “This project needs its own server.” After a while, that approach became expensive, difficult to manage, and honestly unnecessary for many business applications. Today, I host multiple Node.js applications on a single AWS Lightsail instance using Apache Virtual Hosts and PM2. This setup has helped me reduce infrastructure costs, simplify deployments, and manage projects more efficiently. Here’s how it works. Why I Chose AWS Lightsail For many business applications, AWS Lightsail provides: Predictable pricing Instead of spinning up separate servers for every client or internal application, I consolidate multiple applications on a single instance. My Architecture The basic flow looks like this: Internet PM2

Apache handles incoming traffic and routes requests to the correct application. PM2 keeps all Node.js applications running. Folder Structure I typically organize projects like this: /var/www/ Each project has: Separate repository This keeps deployments clean. Why PM2 Is Essential Running Node.js applications directly is risky. If the process crashes, your application goes offline. PM2 provides: Auto restart Example: pm2 start server.js —name client-project-1 After a reboot, everything comes back automatically. Apache Virtual Hosts Each domain points to a different internal port. Example:

ServerName project1.com

ProxyPass / http://localhost:3001/ ProxyPassReverse / http://localhost:3001/

Another application:

ServerName project2.com

ProxyPass / http://localhost:3002/ ProxyPassReverse / http://localhost:3002/

The user never sees the internal ports. Everything feels like a normal website. Biggest Benefits Instead of paying for multiple servers, several projects can share one instance. Easier Maintenance One server. One monitoring setup. One backup strategy. Faster Deployments Deployments become predictable and repeatable. Better Resource Usage Most business applications never fully utilize an entire server. Mistakes I Learned to Avoid A few mistakes I made early on: Running applications without PM2 Fixing these made the setup much more stable. When I Wouldn’t Use This Setup I would choose dedicated infrastructure when: Traffic becomes very high For many small and medium business projects, though, a single Lightsail instance works surprisingly well. Final Thoughts One of the biggest lessons I’ve learned is that infrastructure doesn’t need to be complicated. A simple combination of: AWS Lightsail can power multiple production applications reliably and cost-effectively. How are you hosting your Node.js applications today? I’d love to hear your setup in the comments.

node

aws

devops

webdev

0 views
Back to Blog

Related posts

Read more »

Introduction to Git

Welcome to Git Mastery, a series where we'll learn Git from the ground up, starting with the absolute basics and gradually moving toward advanced workflows, Git...