How to make my Next.js app with Better-SQLite3 open successfully on cPanel?
04:30 22 Feb 2026

I have a Next.js application that uses Better-SQLite3 as its database. I want to deploy it on cPanel. Here's what I did:

  1. Ran npm run build locally.

  2. Zipped all files except node modules.

  3. Uploaded the zip to public html/my-app on cPanel and extracted it.

  4. In the Node.js setup section on cPanel, I:

    • Selected Node version: 20.20.0

    • Application mode: production

    • Application root: public html/my-app

    • Application URL: https://example.com/myapp

    • Startup file: server.js

  5. Ran “NPM Install” in cPanel.

  6. Started the application.

When I visit https://example.com/my-app, I get a 503 error: “Server is temporarily busy, try later.”

How to fix that and make it work successfully?

My server.js looks like this:

const { createServer } = require("http");
const { parse } = require("url");
const next = require("next");

const port = process.env.PORT || 3000;
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(port, (err) => {
    if (err) throw err;
    console.log(`> Ready on http://localhost:${port}`);
  });
});
next.js deployment