概要: Before Node.js applications can be hosted in Plesk, Node.js support must be enabled.

In this topic, you will learn how to enable the support for Node.js hosting in Plesk. You will also learn how to control which Node.js versions are available, whether Node.js is available to customers, and also how to make Node.js applications' logs visible or invisible to customers.

If you want to learn how to host and manage Node.js applications in Plesk, read the Hosting Node.js Applications topic instead.

Node.js のサポートを有効化する

Before your customers and resellers can host Node.js applications, the free Node.js Toolkit extension must be installed on the Plesk server from the Extensions Catalog <installing-extensions>`.

Node.js バージョンを管理する

Plesk は、Node.js の latest stable および LTS リリースをサポートしますが、以下の制約事項があります。

  • (Plesk for Linux) Multiple Node.js versions can be installed simultaneously, and Node.js applications on different domains can use any available Node.js version.
  • (Plesk for Windows) 常に 1 バージョンの Node.js だけインストールでき、サーバ上のすべての Node.js アプリケーションに対してこのバージョンが使用されます。

To see what Node.js versions are installed on the server, go to Extensions, open the "My Extensions" tab, and then click Open next to the "Node.js Toolkit" extension.

image nodejs versions

Here you can see the Node.js versions installed on the server. Versions marked with the image enabled icon icon are enabled, and those marked with the image disabled icon are disabled. You can also see the paths to their corresponding binaries, and also the number of domains using a particular Node.js version. In Plesk for Linux, you may also see one or more Node.js versions available for installation.

Disabling or enabling a Node.js version:

  1. Plesk にログインします
  2. Go to to Extensions, open the "My Extensions" tab, and then click Open next to the "Node.js Toolkit" extension.
  3. Click the image enabled icon icon for an enabled Node.js version to disable it.
  4. Click the image disabled icon icon for a disabled Node.js version to enable it.

Disabling a Node.js version has the following effects:

  • 無効化した Node.js バージョンは、ドメインの Node.js アプリケーションを管理するときに選択できなくなります。
  • 既存の Node.js アプリケーションが、別の有効化された Node.js バージョンに切り替えられます(可能な場合)。
  • サーバ上のすべての Node.js バージョンが無効である場合、少なくとも 1 つの Node.js バージョンを再び有効化するまでは、既存の Node.js アプリケーションがすべて停止し、ドメインの Node.js アプリケーションを管理することはできなくなります。

(Plesk for Linux) Installing or uninstalling a Node.js version:

  1. Plesk にログインします
  2. Go to to Extensions, open the "My Extensions" tab, and then click Open next to the "Node.js Toolkit" extension.
  3. If the Node.js version you want to uninstall is enabled, click the image enabled icon icon to disable it first.
  4. Click Uninstall for a disabled Node.js version to uninstall it.
  5. Click Install for a Node.js version that is not installed to install it.

(Plesk for Windows) Changing the installed Node.js version:

  1. Plesk にログインします
  2. Go to Tools & Settings, click Updates (under "Plesk"), and then click Add/Remove Components.
  3. Expand the "Node.js hosting features" section, select the desired Node.js version under the "Node.js Engine" component, and then click Continue.

Node.js への顧客のアクセスを制御する

Node.js サポートを有効化すると、サービスプランと契約に以下のパーミッションが追加されます。これらを使用して、Node.js 機能への顧客のアクセスを制御することができます。

  • "Node.js support management」により、顧客はドメイン用に Node.js サポートを有効化することができます。
  • "Node.js state management」により、顧客はアプリケーション用にアプリケーションモードを変更することができます。
  • "Node.js version management」により、顧客はアプリケーション用に Node.js バージョンを変更することができます。

Node.js アプリケーションのログの表示/非表示を管理する

Node.js アプリケーションでは、以下の場所にログを書き込みます(アプリケーションのコンソール出力を含む):

  • (Plesk for Linux) /var/log/passenger/passenger.log
  • (Plesk for Windows) %plesk_vhosts%<webspace_name>\logs\iisnode

Node.js アプリケーションのトラブルシューティングが必要な場合は、これらのログを参照すると参考になります。

デフォルトで、管理者と顧客およびリセラーは、Node.js アプリケーションのログをドメインログブラウザで参照できます。ドメインログブラウザでこれらのログを表示するかどうかは panel.ini ファイルで管理できます。

ドメインログブラウザでの Node.js アプリケーションの表示を管理するには:

  1. panel.ini ファイルを編集用に開きます。ファイルは以下の場所にあります。

    • (Plesk for Linux) /usr/local/psa/admin/conf/panel.ini
    • (Plesk for Windows) %plesk_dir%admin\conf\panel.ini

    Panel.ini Editor 拡張を使用すると、Plesk インターフェースでもファイルを編集できます。

  2. [ext-nodejs] の下に以下の行を追加して、ファイルを保存します。

    • (ログを表示する場合)showApplicationLogs = true
    • (ログを表示しない場合)showApplicationLogs = false