Skip to main content

Node.js application

Your Node.js application (e.g. Next.js, Nuxt, Express) can serve the domain's requests instead of PHP. The application runs continuously and restarts automatically after an error. The Node.js application menu item is shown only if Node.js is included in your plan – otherwise change the plan. The number of applications and their resources are limited by the plan; the limits are shown on the Resources card.

The "Node.js application" page

Starting​

  1. Go to Panel → My services → [your hosting service] → Node.js application, select a domain in the Domain field and turn on the switch on the Run a Node.js application card.
  2. On the Application card, set the Application directory (containing package.json), the Entry file (e.g. app.js or npm start) and the Node.js version. For Next.js, use next start without the -H parameter.
  3. If needed, add variables on the Environment variables card. PORT, HOST and NODE_ENV=production are set automatically.
  4. Click Save.

To have the domain run on PHP again, turn the same switch off.

Uploading the application​

  1. Upload the code over SFTP or git to the application directory /home/[username]/domains/[domain]/[application directory].
  2. Install the dependencies over SSH: cd [application directory] && npm install (for Next.js and similar frameworks, also npm run build). You turn on SSH access on the "Plan and access" page.
  3. The application must listen on the port from process.env.PORT.
  4. Set the entry file, save and click Restart application.

If the website returns a 502 error and the status is Not listening, the application is not listening on process.env.PORT – check it with the Log → Show button.