Most cPanel hosts that support Node.js do it through one screen: Setup Node.js App (part of CloudLinux). It looks simple, but a few details decide whether your app runs on the first try or greets you with a 503 Service Unavailable. This guide walks through a clean deployment of an Express, Fastify, NestJS or Next.js app, start to finish.
Before you start
- Your app must start from one file — usually
app.js,server.jsorindex.js. Frameworks with their own CLI (Next.js, Nuxt) need a tiny starter file; see below. - Listen on the port you are given. Use
app.listen(process.env.PORT || 3000). cPanel's app server connects your domain to whatever port the process listens on, so never hard-code 80 or 443. - Know your Node.js version. Check the
enginesfield inpackage.jsonor what you use locally (node -v). A version mismatch is the most common cause of a crash on start.
1. Upload the code
Create a folder outside public_html, for example /home/youruser/myapp, so your source code and .env are never downloadable. Upload your project there with the cPanel File Manager (zip it, upload, extract), with SFTP, or with git clone over SSH. Don't upload node_modules — it's rebuilt on the server.
2. Create the application
In cPanel open Setup Node.js App → Create Application and fill in:
- Node.js version — the one your app was built for.
- Application mode —
Production. - Application root — the folder from step 1 (e.g.
myapp). - Application URL — your domain, or a path such as
/api. - Application startup file — e.g.
server.js.
Press Create. cPanel builds a private Node environment for the app and wires your domain to it.
3. Install dependencies
Once the app exists, a Run NPM Install button appears (it reads your package.json). If you prefer the terminal, the same screen shows a command like source /home/youruser/nodevenv/myapp/20/bin/activate && cd /home/youruser/myapp — paste it in SSH, then run npm ci or npm run build as you would locally.
4. Environment variables
Add NODE_ENV, database URLs and API keys under Environment variables on the same page instead of committing a .env file. Press Save, then Restart — variables are only read when the app starts.
5. Next.js and other framework CLIs
The app server starts a file, not npm start. For Next.js, run npm run build over SSH, then use a small server.js as the startup file:
const { createServer } = require('http');
const next = require('next');
const app = next({ dev: false });
const handle = app.getRequestHandler();
app.prepare().then(() => {
createServer((req, res) => handle(req, res)).listen(process.env.PORT || 3000);
});
6. HTTPS and the database
cPanel's AutoSSL issues the certificate for your domain automatically; once it shows as valid, force HTTPS in Domains. Create a MySQL database and user in MySQL Databases, and connect to localhost from your app.
If it shows 503 or a blank page
That almost always means the process crashed while starting — a missing dependency, a wrong startup file, an ES-module/CommonJS mix-up, or a variable that isn't set. We wrote a separate guide for exactly this: Node.js app shows 503 on cPanel — how to fix it.
Want it done for you?
On Droxin Node.js hosting all of this is ready on fast NVMe servers, and our engineers will deploy the first version with you — and fix it if it ever breaks. Already on another host and stuck? Send us the site; you pay only after it's working.