How to Deploy an Express.js Server on a VPS with a Subdomain

Abhishek madoliya 16 Jan 2026 6 min read #Express.js Server
How to Deploy an Express.js Server on a VPS with a Subdomain

Let me start with a simple question. What actually happens after you build an Express.js app?

Not the tutorial answer. I mean the real one. You’ve written routes, connected MongoDB, tested APIs on localhost:3000… and then what? This is point where most students, freshers, and even working developers fails to think beyond development. Most new developers don’t really focus on deployment, even though it’s one of the most important steps in developing any software.

And yes, deployment is still one of the most underrated—and most career-relevant—skills right now. Deployment also helps fresher job aspirants in their software engineering interviews, especially if you have knowledge of Linux and deployment through a VPS (Virtual Private Server).

Why You Must Learn About Deploying Apps on a VPS

Here’s the reality of new developers. Companies will not you because you know Express.js. They can hire you because you can run Express.js in the real world. Learning deployment not only helps you in interviews and getting a job, but it is also a major part of developing any technology and building businesses online. If you know how to deploy your applications on a VPS, it helps you build and host your application publicly for users.

I learned deployment with a VPS a few months ago, and now I have my product online, serving services for free. This is how learning deployment can help and motivate you to build your own application that solves real problems. You can check the product I’ve built here: Try Cloudvyn.

A VPS (Virtual Private Server) with a subdomain is not an ‘old-school’ deployment strategy. In fact, it’s becoming more relevant as teams move away from heavy, abstracted platforms and look for more control, better performance, and predictable infrastructure costs. With a VPS, you know exactly where your application runs, how traffic reaches it, and what happens when something breaks. Here’s the part most people miss: AI can write routes, generate APIs, and even suggest server configurations. But AI cannot take ownership of a production server. It won’t be on call when your site goes down, won’t debug a misconfigured firewall at 2 AM, and won’t make trade-offs between performance, security, and cost. That responsibility still sits with engineers who understand how systems behave in the real world. That’s why deployment knowledge matters. It’s not about memorizing commands—it’s about understanding how applications live on the internet. And that understanding is what separates developers who can build demos from those trusted to run real products.

Outdated Deployment Skills vs Future-Proof Ones

What’s Slowly Becoming Outdated

Shared hosting with cPanel, FTP-based deployments, and one-click setups you don’t actually understand.These tools aren’t useless, but they don’t prepare you for real engineering decisions.

What’s Future-Proof Deployment Skills

Running Node.js on a Linux VPS. Using Nginx as a reverse proxy. Handling subdomains properly and Understanding ports, processes, logs, and failures.

This is what backend, full-stack, and DevOps-adjacent roles expect now.

What Is a VPS (Virtual private server), Really?

image showing what is vps (virtual private server)

What is a VPS?

Think of it as your own small Linux computer on the internet that is available 24×7. It’s not shared with random users. It’s not hidden behind heavy abstractions. You decide what runs, what stops, and what breaks. It’s your own private server—no normal user can access it without the password and IP address.

Providers like DigitalOcean, Linode, Vultr, and AWS Lightsail all give you the same basics: an IP address and SSH access.That’s enough to run a real production server.

What Is a Subdomain and Why Use One?

Who actually uses subdomains in real projects?

Almost everyone uses subdomains, especially for production-independent apps, products, or project servers and admin panel access. Examples like api.yoursite.com, admin.yoursite.com, or auth.yoursite.com exist because they make systems cleaner and easier to scale.

This separation matters more as applications grow. This setup is a widely accepted approach and is still used in production applications.

Step 1: Prepare Your Express.js App

Before touching the server, your app needs to behave like a production app.

Ask yourself: does your app use environment variables? Does it read the port from process.env.PORT? Does it fail gracefully?


const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server running on port ${PORT}`);
});

        

If your app only works on localhost, deployment will expose that weakness fast. And honestly, that’s a good thing.

Step 2: Set Up the VPS

When you create a VPS, you’ll receive an IP address and SSH credentials. You can use those credentials to access your VPS.

You connect using:


ssh root@your_server_ip


        

From there, you update the system and install Node.js, Git, and Nginx.

This is where many developers realize Linux isn’t scary - it’s just a machine acting as a server for your applications.

Step 3: Point the Subdomain to Your VPS

This step happens in your domain provider’s DNS panel.

You create an A record where the subdomain points to your VPS IP address.

What does this mean? When someone visits api.yoursite.com, the internet now knows where to send the request.

Step 4: Run Express with a Process Manager

Let’s be honest. Running node index.js and closing the terminal is not deployment.

Tools like PM2 keep your app alive, restart it if it crashes, and survive server reboots.

This is what real production environments use.

Step 5: Use Nginx as a Reverse Proxy

Your Express app should not face the internet directly.

Nginx handles incoming traffic, manages ports, and forwards requests to your Node.js server.

The flow becomes simple and reliable: User → Nginx → Express → Response.

Step 6: Enable HTTPS

Who expects HTTPS today?

Everyone. Browsers, users, search engines, and APIs.

With Let’s Encrypt and Certbot, securing your subdomain is free and fast. Without HTTPS, trust breaks instantly.

What Deployment Skills Are Still in Demand in Companies

When a recruiter hears that you deployed an Express.js API on a VPS with Nginx and a subdomain, they don’t hear “a tutorial project made from YouTube.” They hear that you understand production systems, failures, and responsibility.

Roles Affected by AI vs Roles That Benefit

AI affects developers who only write basic CRUD code without understanding deployment.Developers who understand infrastructure, production behavior, and real users benefit instead of getting replaced.

What’s the Difference Between Deploying on Vercel and Deploying on a VPS

Deploying on services like Vercel or Render and deploying on a Linux VPS have a huge difference in terms of understanding how servers work in real life and how things actually work internally. Services like Vercel and Render also use VPSs to host users’ production apps, but they are abstracted away from you. You don’t interact with Linux systems directly—you just upload your code to their platform, and they handle everything else. Because of this, you don’t really know how your app is deployed or what happens during the deployment process.

Conclusion

Deploying an Express.js server on a VPS with a subdomain isn’t about servers. It’s about confidence.

Confidence that your code can survive the real internet. Confidence that you understand how systems actually work.

In the 2026–2027 tech landscape, that confidence is rare. And rare skills are the ones that get noticed.

want to learn Frontend deployment : Learn about React app deployment on vps