ispmanager 6 lite, pro, host

Installing Node.js

Node.js is not supported for the OpenLiteSpeed ​​web server in the current version of ispmanager.

Node.js requirements

Node.js repositories must be accessible over HTTPS.

Node.js installation

  1. Log in to ispmanager with superuser permissions.
  2. Go to the Software configuration section.
  3. Select Node.js.
  4. Click on the toolbar.
  5. Confirm the installation.
  6. Wait for the installation to complete.

After installation, the panel will:

Next, proceed to user setup.

User setup

To enable a user to work with Node.js projects, enable the following options in their user settings:

Users with the ability to use Node.js are marked with the icon in the Settings column.

This option can be dasibled if the user doesn't have any Node.js-enabled sites.

Uninstalling Node.js

Uninstalling is not possible if there are sites running Node.js in the control panel.

To uninstall Node.js:

  1. Log in to ispmanager with superuser rights.
  2. Go to the Software configuration section.
  3. Select Node.js from the list.
  4. On the toolbar, click .
  5. On the Settings page, uncheck Node.js.
  6. Click Save.

The control panel will uninstall Node.js and related software — npm, pm2.

Node.js technical details

When installing Node.js, the ispmanager panel downloads the ispmanager-pkg-nodejs package.

Request handling

A Node.js application is run via the process manager pm2, while the site's web server—Nginx, LiteSpeed, or Apache—acts as a reverse proxy, forwarding requests to it:

  • Nginx: proxies dynamic content only, using the ngx_http_proxy_module
  • LiteSpeed ​​and Apache: proxy both static and dynamic content, including requests for non-existent files, using the mod_proxy module. The built-in LiteSpeed ​​handler for Node.js is not used.

If both Apache and Nginx are installed on a server running ispmanager, Nginx handles and proxies all requests to the site; Apache is not used for the site in this configuration.

Exceptions to proxying

Requests to the following paths are not proxied to Node.js but are instead handled directly by the site's web server (LiteSpeed, Apache, or Nginx):

  • the /.well-known/acme-challenge directory (used for Let's Encrypt validation)
  • the site statistics directory (if statistics collection is enabled)
  • site redirects
  • phpMyAdmin, phpPgAdmin, and Roundcube when accessed via the site's domain
Details

In the Apache configuration files for phpMyAdmin, phpPgAdmin, and Roundcube (located at /etc/apache2/conf.d/ or /etc/httpd/conf.d/), an exception has been added next to the Alias ​​directive to exclude the path from proxying—for example:

Alias /roundcube /usr/share/roundcube
<IfModule proxy_module>
	<Location /roundcube>
		ProxyPass !
	</Location>
</IfModule>

If access to the ispmanager control panel is configured via the website's domain, then HTTPS requests to the site are handled by the panel's built-in web server.

Apache configuration file example

For more details on proxy configuration parameters, please refer to the official Apache documentation.

A block is added to the Apache configuration file for the site:

RewriteEngine on
	RewriteCond %{HTTPS} off
	RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge
	RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
	<IfModule proxy_module>
		ProxyRequests Off
		ProxyPreserveHost On
		<Location /.well-known/acme-challenge>
			ProxyPass !
		</Location>
		ProxyPass / unix:/var/www/www-root/data/nodejs/0.sock|http://localhost/
		ProxyPassReverse / http://localhost/
	</IfModule>
	<IfModule headers_module>
		RequestHeader set X-Forwarded-Proto "http"
	</IfModule>
Details
  • The Rewrite block is added only if the site has HTTP-to-HTTPS redirection enabled, and it is placed exclusively within the HTTP host configuration:
    • RewriteEngine on — enables the mod_rewrite URL rewriting module
    • RewriteCond %{HTTPS} off — checks whether the current request was made via the unencrypted HTTP protocol
    • RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge — creates an exception for the directory used to verify SSL certificates (e.g., for Let's Encrypt). Without it, Let's Encrypt would be unable to verify the site's domain over HTTP, preventing the issuance of a certificate.
    • RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] — redirects all other HTTP requests to the same address, but using https://. The R flag indicates a redirect, while the L flag stops the processing of any subsequent rules
  • ProxyRequests Off — disables the use of Apache as a forward proxy
  • ProxyPreserveHost On — passes the original Host header (the site name) to the Python application
  • <Location …> ProxyPass ! — defines exceptions for proxying
  • Methods for connecting to Python:
    • ProxyPass / unix:<ПУТЬ_К_СОКЕТУ>|http://localhost/ — a socket file
    • ProxyPass / http://127.0.0.1:ПОРТ/ — a port
  • X-Forwarded-Proto — indicates the connection protocol: http or https
  • ProxyPassReverse / http://localhost/ — replaces internal web server addresses with the actual domain name in responses from the Python application.

Node.js service directories

To ensure proper project operation, utility directories are created in the user directory:

  • /var/www/USERNAME_data/.npm/ — npm package manager data
  • /var/www/USERNAME_data/.nvm/ — installed Node.js versions
  • /var/www/USERNAME/data/.pm2/ — pm2 process manager data

If you delete these directories, they will be recreated the next time you edit the site, though npm and pm2 may not function properly.

Node.js log

Select a project in the Sites section → click → in the context menu, click Log.

List of logs:

  • PROJECT_NAME-error.log — a file containing startup commands errors
  • PROJECT_NAME-install.log — a file containing the results of reading package.json and installing dependencies
  • PROJECT_NAME-out.log — a file containing the output of the new command and its entry in the Select a command from the list of available commands
  • PROJECT_NAME.access.log — a file containing information about the devices which the project was opened on
  • PROJECT_NAME.error.log — a file containing projects launch errors