How to Deploy a Next.js App on cPanel Shared Hosting
You can deploy a Next.js app on cPanel by building it and running its Node server through Setup Node.js App — or, if your site does not need server-side features, by exporting it as static files, which is far simpler. Choosing the right path saves a lot of trouble.
First decide: static or server?
- Static export — if your site does not need server-side rendering or API routes at runtime, export it to static HTML and host it like any static site. Simplest and fastest on shared hosting.
- Node server — if you need SSR or API routes, run Next.js as a Node app under Passenger.
Option A: Static export (simplest)
Build and export your app to static files, then upload them to your domain's document root via File Manager. No Node process needed — it is served as static content.
Option B: Running the Next.js server
- Build your app (
next build) — ideally build locally and upload, since shared resources for building can be limited. - Upload the project with your
package.json. - In Setup Node.js App, set the root and startup file to start Next in production, and install dependencies.
- Ensure it listens on
process.env.PORT, then start the app.
A note on resources
Next.js server mode uses more resources than a simple site, and shared hosting has limits — see working within memory limits. For a busy SSR app, a VPS (or Webuzo — see deploying Next.js on Webuzo) is often a better fit.
Frequently asked questions
Should I build on the server or locally?
Build locally where you can, then upload the result. Building on shared hosting can hit memory or time limits — see fixing build failures.
Can I just export Next.js as static?
If your site does not need runtime server features, yes — a static export is the easiest and most reliable way to host Next.js on shared hosting.
Why is my Next.js app slow or stopping on shared hosting?
SSR is resource-hungry and shared plans limit resources and persistent processes. Consider static export where possible, or move to a VPS for a demanding app.
Was this article helpful?