MERN Stack

Building a Sample App with MERN Stack on AlmaLinux 8.6 VPS from Domain India

By the Domain India teamPublished 5 min read
Knowledge base article
Contents (3 sections)

You can run a MERN app (MongoDB, Express, React and Node.js) on an AlmaLinux VPS from Domain India, but the recipe many older guides give no longer works in 2026: Node.js 16 is long out of support, MongoDB will not install without its own repository, and a React development server should never face the internet. This page gives you the short, current version and sends you to our full step-by-step guide.

For the full guide, see our MERN deployment guide

The complete, tested walkthrough, with every command and configuration file, is Deploying and managing MERN stack applications on a RHEL-based VPS. It covers AlmaLinux and Rocky Linux 9 and 10. This page is a summary.

Key takeaways

Use a current AlmaLinux release (9 or 10), not 8.6. Install Node.js 22 or 24, add MongoDB's official repository and install MongoDB 8.0 with authentication on and bound to 127.0.0.1. Run the Express API under PM2, build the React app and let nginx serve the build and proxy /api to Node, then add a free Let's Encrypt certificate. This applies to a VPS you manage yourself, not to shared hosting.

1. What has changed since the old version of this guide

Old instructionWhy it fails nowDo this instead
AlmaLinux 8.6An old point release; new servers should start on a current releaseAlmaLinux 9 or 10
NodeSource setup_16.xNode.js 16 reached end of life in 2023Node.js 22 or 24 LTS
dnf install mongodb-orgThe package is not in AlmaLinux's own repositoriesAdd MongoDB's official 8.0 repository first
npm start for the React client behind nginxThat is a development server, not for productionBuild the client and let nginx serve the files
proxy_pass to port 3000Points nginx at the development serverProxy /api to the Express port and serve the build directly
No database passwordMongoDB without authentication is open to anyone who reaches itCreate users and turn on authorization

2. The steps in brief

  1. Secure the server.
    Create a sudo user, log in with an SSH key, turn off root and password logins, and allow only SSH, HTTP and HTTPS in firewalld.
  2. Install Node.js LTS.
    On AlmaLinux 9, sudo dnf module enable -y nodejs:22 and then sudo dnf install -y nodejs git. Install PM2 with sudo npm install -g pm2.
  3. Install MongoDB 8.0.
    Add the mongodb-org-8.0 repository file, install mongodb-org, start mongod, create an admin user and an app user in mongosh, then set security.authorization: enabled and keep bindIp: 127.0.0.1.
  4. Deploy the API.
    Clone your repository, run npm ci --omit=dev, put the connection string in a .env file readable only by you, and start the API with PM2 on a local port such as 5000.
  5. Build the React app.
    Run npm run build (Vite outputs to dist/) and copy the files to a folder such as /var/www/app.
  6. Configure nginx.
    Serve the build folder, send /api/ to 127.0.0.1:5000, and add try_files $uri /index.html; so React routes work on refresh. On AlmaLinux, allow the proxy under SELinux with sudo setsebool -P httpd_can_network_connect 1.
  7. Add HTTPS.
    Install Certbot from EPEL and run sudo certbot --nginx -d example.com -d www.example.com.

Each step, with the exact files, is in the full guide. For a distribution-neutral version of the same setup, see Running MERN or MEAN on a clean VPS.

Never open MongoDB to the internet

Do not open port 27017 in the firewall. Your API runs on the same server and connects to MongoDB locally. An exposed MongoDB without authentication is one of the most common causes of stolen or wiped data.

3. Running this on Domain India

A Domain India VPS is self-managed: you get full root access on KVM virtualisation and you administer the operating system and software yourself. VPS plans do not include cPanel. Shared hosting cannot run this stack, because you cannot install MongoDB there. If you would rather not manage a server, the App Platform detects and builds Node.js apps automatically and includes PostgreSQL, but not MongoDB. See Getting started with the App Platform.

VPS Starter
₹552.65/mo + GST
  • 1 vCPU
  • 2 GB DDR4 RAM
  • 64 GB NVMe SSD Storage
  • 2 TB Monthly Bandwidth
See plan details

The card shows the live Domain India price, excluding 18% GST.

Can I still follow a MERN guide written for AlmaLinux 8.6?

Not as written. It installs Node.js 16, which is out of support, and assumes MongoDB is in the system repositories, which it is not. Start on AlmaLinux 9 or 10 with Node.js 22 or 24 and MongoDB's official repository.

Which Node.js version should I use for a MERN app in 2026?

Node.js 22 or 24, the supported LTS lines. Node.js 20 and older have reached end of life.

Should nginx proxy to the React development server on port 3000?

No. Build the React app and let nginx serve the built files, and proxy only the API path, such as /api/, to your Express server.

Can I run a MERN stack on Domain India shared hosting?

Not the full stack. Shared hosting can run small Node.js apps from the control panel, but you cannot install MongoDB there. Use a VPS, or the App Platform with a database it supports.

Does Domain India manage the VPS for me?

No. Domain India VPS plans are self-managed with full root access. You install, secure and update the software yourself.

Ready to deploy? Follow the full MERN deployment guide, compare VPS plans, or look at the App Platform if you would rather not run a server. Questions about which fits your app? Open a support ticket.

Run your MERN app on a VPS

Full root access on KVM virtualisation, with your choice of Linux distribution.

See VPS plans

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
MERN Stack on an AlmaLinux VPS: Updated Steps for 2026