Plesk

How to install and run Node.js application in Plesk?

Question

How to install Node.js application in Plesk?

Answer

In the Plesk interface

  1. Log in to Plesk.

  2. Upload the Node.js application files, including package.json, to the server using File Manager.

  3. Go to Domains > example.com > Create Website > Node.js and set the application configuration:

    • In Plesk for Linux: the Document Root directory must be the subdirectory of the Application Root directory:

      Click Install

      Note: app.js should be located in Application Root.

    • In Plesk for Windows: the Application Root directory must be same as the Document Root directory.

  4. Click NPM install and Run script if necessary.

In the command-line interface (Linux only)

  1. Connect to the server using SSH.

  2. Run npm install "packagename" command to fetch and install the package from a npmjs.com repository. "packagename" should be replaced with your package name. In the example below, the application blockchain-wallet-service is used.

    # export PATH=$PATH:/opt/plesk/node/18/bin
    # npm install -g blockchain-wallet-serviceĀ 
    # blockchain-wallet-service start --port 3000

    Note: instead of the root user, it is better to use one of the system users of subscriptions to run 3rd-party applications in order to avoid possible security issues.

If there is no executable /opt/plesk/node/18/bin/npm, go to the Plesk menu Tools & Settings > Updates and Upgrades > Add/Remove Components and install the components Node.js support.

Additional information

Plesk Administrator's Guide - Hosting Node.js Applications

Exit mobile version