How it runs

The account has no root access and cPanel’s Node.js app setup is turned off. These five steps get a Next.js app online anyway.

  1. Install Node in the home folder

    The official Linux build, unpacked into the account’s home folder.

    ~/node/bin/node -v   # v22.20.0
  2. Build the app

    The source lives outside the web root, so nothing in it is public.

    cd ~/apps/test-next
    npm install
    npm run build
  3. Start it on a local port

    Next.js listens on 127.0.0.1 only, so it can’t be reached directly.

    next start -H 127.0.0.1 -p 3100
  4. Proxy the subdomain to it

    The subdomain’s .htaccess tells LiteSpeed to pass every request to that port.

    RewriteEngine On
    RewriteRule ^(.*)$ http://127.0.0.1:3100/$1 [P,L]
  5. Restart it if it stops

    A cron job checks the port every minute and starts the app again if nothing answers.

    * * * * * ~/apps/test-next/keepalive.sh

Limits

This is fine for demos and small sites. The account’s resource limits can stop the process, and the cron job brings it back within about a minute. For production, enable cPanel’s Node.js app setup in WHM or host the app on Vercel.