Skip to content

How to Install Node.js and Run a Node.js App on CWP

Updated 2 min read

Updated: 30 September 2026 · Applies to: CWP (Control Web Panel) on AlmaLinux 8 and 9 and other Enterprise Linux 8 and 9 servers; Node.js 20 and 22

CWP does not install Node.js itself, but you can add it to the server and let CWP's web server pass a domain's traffic to your Node.js application. The older version of this guide used Node.js 8 to 12, which are all long out of support. Use a current long-term support release instead: Node.js 22 (or 20). We installed Node.js 22 from AlmaLinux 9's module streams.

1. Install Node.js

As root over SSH:

dnf module reset nodejs
dnf module install nodejs:22/common
node -v
npm -v

This installs Node.js from the operating system's own repositories, so it updates with dnf upgrade. The module streams on version 9 offer Node.js 18, 20, 22 and 24; pick one that your application supports and that is still maintained.

2. Run your application as a service

Run the application as the CWP user who owns the site, on a local port such as 3000. A systemd unit keeps it running and restarts it after a crash or reboot. Create /etc/systemd/system/myapp.service:

[Unit]
Description=My Node.js app
After=network.target

[Service]
User=cwpuser
WorkingDirectory=/home/cwpuser/myapp
Environment=NODE_ENV=production PORT=3000
ExecStart=/usr/bin/node server.js
Restart=on-failure

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now myapp
curl -I http://127.0.0.1:3000/

Make the application listen on 127.0.0.1 only, so it is reachable through the web server and not directly from the internet.

3. Send the domain's traffic to the application

In the CWP admin panel, go to WebServer Settings > WebServers Domain Conf, choose the user and the domain, and select a proxy configuration that forwards to a custom port. CWP's documentation recommends Nginx proxying directly to the application's port; enter 3000 (or your port). CWP writes the virtual host and reloads the web server.

Then enable SSL for the domain in CWP (AutoSSL / Let's Encrypt) so visitors use HTTPS.

4. Update the application

cd /home/cwpuser/myapp && sudo -u cwpuser npm ci --omit=dev
systemctl restart myapp

If you would rather have us manage the panel and application, see our managed CWP VPS.

Official documentation: CWP wiki: Node.js on CWP and Node.js release schedule.

Was this answer helpful?

Still stuck? Open a ticket