.png&w=3840&q=75)
Websites & Hosting4 min
How to Deploy a Next.js Application on cPanel Hosting
NS
NameSilo Staff9/9/2026
Share
To deploy a Next.js application on cPanel hosting, you must use the "Setup Node.js App" tool. First, build your Next.js app locally using next build. Upload the .next, public, and package.json files to your cPanel directory via File Manager. Create a custom server.js entry file, configure the Node.js application in cPanel, and start the app.
Before starting: Confirm which Node.js versions are available under Setup Node.js App in your cPanel, since supported versions vary by host and account.
How Phusion Passenger Handles Node.js Runtimes
cPanel doesn't run Node.js natively. It uses Phusion Passenger, an application server sitting between Apache and your app. Passenger assigns your app a port automatically via the PORT environment variable and routes incoming HTTP traffic to it, no manual port configuration or firewall rules needed.
Passenger also runs Node apps on-demand rather than as a permanently running process, closer to serverless than a dedicated server. Your app "wakes up" when a request arrives, so the first request after idle time can take 10-15 seconds to spin up.
Why It Matters: Affordable Hosting for Modern Frameworks
Platforms built specifically for Next.js offer excellent performance but come with recurring costs that scale with traffic. Running Next.js on existing cPanel infrastructure lets you host a production SSR app for the price of standard shared hosting, a meaningful option for smaller projects or budget-conscious launches that don't need edge-network scale.
Step 1: The Local Build
Run next build on your local machine, never on the server itself. This pre-compiles your app into the .next directory, avoiding the memory and CPU exhaustion that compiling on a shared server can trigger.
Upload these to your application root via File Manager: the .next folder, public folder, package.json, and package-lock.json. Skip node_modules, dependencies install directly on the server instead.
Step 2: The Custom Server File
Next.js's built-in next start command isn't directly usable here. Passenger expects a JavaScript entry file that calls .listen() on a standard Node HTTP server, not a CLI command. Create server.js in your project root:
const { createServer } = require('http');const { parse } = require('url');const next = require('next');const dev = process.env.NODE_ENV !== 'production';const app = next({ dev });const handle = app.getRequestHandler();
app.prepare().then(() => { createServer((req, res) => { const parsedUrl = parse(req.url, true); handle(req, res, parsedUrl); }).listen(process.env.PORT || 3000, (err) => { if (err) throw err; console.log('> Ready on port ' + (process.env.PORT || 3000)); });})Update package.json so "start": "NODE_ENV=production node server.js".
Step 3: cPanel Node.js Setup
- In cPanel, go to Software → Setup Node.js App → Create Application
- Select the Node.js version matching your local development environment
- Set Application Mode to Production
- Set Application Root to a folder outside public_html, never expose source files and node_modules directly to the public web
- Set Application URL to your domain or subdomain
- Set the startup file to server.js
- Click Create, then Run NPM Install to install dependencies
- Add any required environment variables, then Save and Restart
Common Mistakes
Enabling Next.js image optimization by default: The built-in next/image optimizer runs server-side and is CPU-intensive, often crashing under real traffic on shared resources. Add unoptimized: true to your image config unless you've confirmed your plan can handle it.
Relying heavily on App Router features: Server Components, Server Actions, and streaming work best on platforms built for them. The Pages Router tends to behave more predictably within shared hosting's resource constraints.
What This Means for You
NameSilo Hosting includes cPanel with Setup Node.js App, giving you direct access to deploy and manage Next.js applications without needing a separate PaaS platform.
Frequently Asked Questions
Can I run Next.js on shared hosting?
Yes, on hosts whose cPanel includes Setup Node.js App via Phusion Passenger.
How do I setup Node.js in cPanel?
Software → Setup Node.js App → Create Application, then configure your settings.
What is a server.js file for Next.js?
A custom entry point that lets Passenger start Next.js via a standard HTTP server.
Why is my Next.js app showing a 503 error in cPanel?
Usually a wrong startup file path, missing dependencies, or a crashed process.
Does cPanel support React apps?
Static React builds work as regular files; SSR frameworks need Setup Node.js App.
How do I upload a Next.js build to cPanel?
Upload .next, public, and package.json via File Manager, skip node_modules.
Can I use PM2 in cPanel?
Rarely needed; Passenger manages the process lifecycle on its own.
Does NameSilo hosting support Next.js?
Yes, via Setup Node.js App and the custom server.js approach outlined above.
.png&w=2048&q=75)
NameSilo StaffThe NameSilo staff of writers worked together on this post. It was a combination of efforts from our passionate writers that produce content to educate and provide insights for all our readers.
More articleswritten by NameSilo

.png&w=3840&q=75)
.png&w=3840&q=75)
.png&w=3840&q=75)