Guides

How to Deploy Next.js on cPanel

Some hosting situations require sticking with existing shared hosting rather than moving to Vercel — many cPanel hosts now support Node.js applications directly, which makes running a Next.js app possible, with some extra manual steps compared to a platform built specifically for it.

Prerequisites

  • arrow_rightcPanel hosting with 'Setup Node.js App' available (check with your host)
  • arrow_rightSSH or terminal access is helpful but not always required
  • arrow_rightA Next.js project ready to build

Step 1: Build the App Locally

npm run build

This produces the .next production build. Unlike a static export, a standard Next.js build needs a Node.js server to run — cPanel's Node.js app feature provides that.

Step 2: Upload and Configure the Node.js App

  1. Upload the project (excluding node_modules) via File Manager or Git
  2. In cPanel, open 'Setup Node.js App' and create a new application pointing at your project folder
  3. Set the application startup file to a small server script that calls next start, or use the Next.js standalone output mode
  4. Install dependencies through cPanel's provided npm install button or terminal

Step 3: Start and Verify

Start the app from the cPanel Node.js interface and check the assigned port is correctly proxied through your domain — most cPanel setups handle this proxy automatically once the app is running.

Common Errors

  • arrow_rightHost doesn't support Node.js at all — pure static hosting can't run a server-rendered Next.js app; a static export (next export equivalent) with no server features is the fallback, or move to Node-capable hosting
  • arrow_rightApp crashes immediately after starting — check the Node.js version selected in cPanel matches what Next.js requires
  • arrow_rightEnvironment variables not picked up — set them in cPanel's Node.js app environment variable section, not just a local .env file

Best Practices

  • arrow_rightUse Next.js's standalone output mode to minimize what needs to be uploaded and run
  • arrow_rightKeep a process manager (cPanel's built-in one, or PM2 if you have shell access) restarting the app automatically on crash
  • arrow_rightFor a purely static site with no server features, consider a static export instead — it removes the need for a persistent Node.js process entirely

Frequently Asked Questions

Can I run Next.js on hosting without Node.js support?add

Only via a fully static export, which drops server-side rendering, ISR, and API routes — appropriate only for content that's genuinely static.

Is this harder than deploying to Vercel?add

Yes, meaningfully — Vercel handles builds, scaling, and Next.js-specific features automatically. cPanel deployment is a valid option when you're constrained to existing hosting, not a recommendation over Vercel by default.

Does ISR work on cPanel hosting?add

It can, since the app is running as a persistent Node.js process, but it depends on your host's specific Node.js app configuration and file system write permissions.

BUILDING SOMETHING SIMILAR?

If you'd rather have this built and shipped than build it yourself, I'm available for freelance and contract work.