Overview

Now that Plesk Onyx and Obsidian natively support Node.js, you can run your applications without any manual changes or hacks to your existing systems. This includes services such as Express, Next.js, Meteor and derivatives which require some server side JavaScript rendering.

Supported versions of node will vary based on the underlying operating system, please contact Conetix to confirm the available versions for your system.

The instructions below will step you through the process of deploying and configuration the application.

Note

Conetix does not support Node.js on shared hosting plans. You will need a Virtual Private Server in order to achieve this.

Instructions

  1. Login to Plesk.
  2. Select the domain you wish to run your Node.js, then select Node.js:
    running a node.js application with plesk
  3. Enter the details about the app:
    running a node.js application with plesk
    This needs to include:
    1. Document Root (location of the static assets to be served by the app)
    2. Application Root (the location of your app files, eg what contains the app.js and libraries)
    3. The application startup file (typically app.js, server.js or similar)
    4. Any Custom environment variables required to run the app (if any)
  4. After you’ve received confirmation that the Startup File exists, you then need to enable Node.js:
    running a node.js application with plesk

Diagnosing issues

If your application fails to start or it’s having an issue, you can enable the debug mode to get further details.

  1. Within the Node.js area, set the Application Mode to development:
    running a node.js application with plesk
  2. If your application fails to start, you should now see a larger error message with further information:
    running a node.js application with plesk
  3. If the brief message isn’t sufficient to diagnose, click on Detailed diagnostics to get a detailed view of what’s going on.

Startup Files

Some Node.js will need a separate startup file. For example, if you run Frontity, you can create a startup file similar to:

var frontity = require("./server").default;
var http = require(‘http’);
var server = http.createServer(frontity);
server.listen(process.env.PORT);

This will need to be saved to a file, eg startapp.js and set as the Application Startup File in the Plesk Node.js configuration.

Tip

The files uploaded should generally be compiled or packaged files. Most frameworks provide you with a build command to produce these files. Uploading the entire app may result in errors for some frameworks.

Was this article helpful?