Skip to content

Migrating an existing application from Node.js Selector to a manual installation

In some cases, you may need to migrate your Node.js application from the Node.js Selector in cPanel to a manual Node.js installation. This is common when moving from shared or reseller hosting to an unmanaged VPS or dedicated server where the Node.js Selector is not available.

  1. Connect to your server via SSH.

  2. Create a directory for your application:

    mkdir ~/myapp
    cd ~/myapp
    npm init -y

    You can name the directory anything you want, not just myapp.

  • On unmanaged hosting packages, you may need to install Node.js and npm manually.
  • Use your Linux distribution’s package manager (e.g., apt, yum, or dnf) to install them.
  1. Log in to cPanel.
  2. On the Tools page → Software → Setup Node.js App, locate your existing application.
  3. Copy the files from the application’s root directory into the new directory you created (~/myapp).
    • Applications created by Node.js Selector obtain port numbers dynamically.

    • For manual installations, assign a specific port number.

    • Example using Express:

      const express = require('express');
      const app = express();
      const port = 3000;
      app.get('/', (req, res) => res.send('Hello World!'));
      app.listen(port, () => console.log(`App listening at http://localhost:${port}`));
    • Node.js Selector apps use the value specified in the Application URL field to create the root path.
    • For manual installations, / is typically the root path.
    • Adjust your routes accordingly.
  • Run your app manually:

    node app.js
  • Or use a process manager like PM2 to keep the app running:

    npm install -g pm2
    pm2 start app.js
    pm2 startup
    pm2 save