# How to host a Node.js app

> Shared hosting cannot run Node, and no setting changes that. Here is why, and the three places that can.

Source: https://cwp.sg/guides/how-to-host-a-website/nodejs/  
Author: Ben Johnson  
Last verified: 2026-09-21

**In short:** - Node.js apps need a persistent process that owns a port. Shared hosting cannot provide that. - PHP runs on shared hosting because it starts and ends per request. Node does not work that way. - If your Node app has no server-side processing, it may work as a static site on any host. - You need a VPS or a Node-friendly platform. Shared hosting for Node is not a thing.

You cannot host a Node.js app on shared hosting, including CWP free hosting. The architecture does not allow it. This page explains why and points you to what actually works.

## Why shared hosting cannot run Node.js

Shared hosting runs PHP. PHP works differently from Node.js.

PHP starts a process when a request arrives, runs the script, sends the response, and exits. The process lives for milliseconds. The web server does not care which PHP process handles which request. Twenty people can visit the same PHP site at the same second and the server spins up twenty temporary processes, one per visitor.

Node.js works the opposite way. A Node app starts one long-lived process that binds to a port (usually 3000) and keeps running. That process listens for requests in memory, holds database connection pools, and manages its own state. The web server cannot assign a random process to a request because there is only one process and it owns the port.

Shared hosting has no mechanism to give you a port. The server runs a single PHP runtime shared among hundreds of accounts. There is no place to park a persistent Node process. Even if you could upload a Node binary, it would be killed when it exceeded the [10 concurrent PHP process limit](/errors/502-bad-gateway/) or the 256 MB memory ceiling, both of which are designed for PHP's short-lived model.

Some platforms offer "Node on shared hosting" by running your app in a jailed container and proxying requests. That is not shared hosting. That is a low-end platform-as-a-service, and it is a different product.

## Check if your app can be a static site first

Many developers assume they need a Node server when they do not.

A Next.js site with `output: 'export'`, or a plain React, Vue, or Eleventy site, produces HTML, CSS, and JavaScript files. Those files need zero server-side processing. You can put them on any web server that serves files over HTTP.

Our free hosting can serve those static files. So can any static host. If your app has no `getServerSideProps`, no API routes, and no `req`/`res` objects, you do not need Node on the server. Read the [static website guide](/guides/how-to-host-a-website/static-website/) to check.

Skipping this step is the most common mistake. People pay for servers they do not need.

## What you actually need

You need either a virtual private server (VPS) that you manage, or a platform that runs Node for you.

A VPS gives you a Linux machine with a public IP. You install Node, start your app, and put nginx in front as a reverse proxy. You are responsible for keeping the process alive when it crashes (use PM2), renewing SSL certificates, and applying security patches. It is the cheapest option per dollar of compute, but it costs your time.

A platform such as Heroku, Railway, or Fly.io runs your Node app from a Git push. They handle SSL, port binding, and restarts. You pay per month per container. The cost is higher than a VPS for the same CPU power, but the setup time is minutes, not hours.

Do not try to run Node on free shared hosting by renaming files or finding a loophole. There is no loophole. The server software does not support long-lived processes, and the [standard web hosting model](/guides/how-to-host-a-website/what-is-web-hosting/) was not built for it. Attempts to hack around this consume your time and produce a `502 Bad Gateway` when the server kills your process.

Use the [hosting calculator](/tools/hosting-calculator/) to compare what each option costs for your traffic. It asks about visitors, storage, and whether you need a database. The answer will tell you which tier of VPS or platform fits.

## If you are absolutely sure you need Node

You should be looking at:

- A VPS from a provider that offers a one-click Node image, typically costing about what you would pay for a coffee subscription each month
- A platform with a free tier that includes Node, but understand the memory and request limits of that free tier

Set up process monitoring on day one. Node processes crash. Without PM2, systemd, or the platform's built-in restart, your site goes down until you notice and SSH in to start it again.

Do not ask shared hosting support to make Node work. They cannot. The limit is in the architecture, not the configuration.

---

Content Website Platform (cwp.sg) operates the free hosting it writes about; see https://cwp.sg/about/ for the methodology and the commercial disclosure.
