---
title: How to deploy a nodejs app on Cyberpanel
description: "Deploying a Nodejs Application on Cyberpanel with Openlitespeed is a seamless process that can be achieved following the steps below. In this guide, I'll be using Nodejs version 18, Almalinux version 8 and sub-domain ## **Steps** ### **Step 1 :…"
url: "https://truehost.com/support/knowledge-base/how-to-deploy-a-nodejs-app-on-cyberpanel/"
updated: "2024-12-09"
category: Cyberpanel
---

# How to deploy a nodejs app on Cyberpanel

Deploying a Nodejs Application on Cyberpanel with Openlitespeed is a seamless process that can be achieved following the steps below.

In this guide, I'll be using Nodejs version 18, Almalinux version 8 and sub-domain

## **Steps**

### **Step 1 : Install Nodejs on Your server.**

##### **Install curl**

Before you begin, ensure that curl is installed on your system. If curl is not installed, you can install it using the following command:

`sudo yum install -y curl`

![](https://truehost.com/support/wp-content/uploads/2024/12/image-147-1024x257.png)

Visit Here to See nodejs versions you can easily install depending on your operating system

https://github.com/nodesource/distributions

##### **Download the setup script for your preferred nodejs version. I'll be using 18 in this example.**

`curl -fsSL https://rpm.nodesource.com/setup_18.x -o nodesource_setup.sh`

![](https://truehost.com/support/wp-content/uploads/2024/12/image-148-1024x208.png)

##### **Run the setup script as root:**

**`bash nodesource_setup.sh`**

You will see below output

![](https://truehost.com/support/wp-content/uploads/2024/12/image-149-1024x385.png)

##### **Install Nodejs**

`dnf -y install nodejs`

![](https://truehost.com/support/wp-content/uploads/2024/12/image-150-1024x510.png)

##### **Confirm node is installed
`node -v`**

![](https://truehost.com/support/wp-content/uploads/2024/12/image-151.png)

### **Step 2: Create a website on cyberpanel and upload your files to the public_html folder.**

Once extracted, ensure to move your files to the public_html folder.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-152-1024x547.png)

![](https://truehost.com/support/wp-content/uploads/2024/12/image-153-1024x407.png)

Next, navigate to the website path via SSH and run npm install

![](https://truehost.com/support/wp-content/uploads/2024/12/image-154-1024x266.png)

`npm install`

![](https://truehost.com/support/wp-content/uploads/2024/12/image-155-1024x221.png)

### **Step 3 : Add Application Context.**

Go back to Cyberpanel dashboard > **Websites > List Website > Manage > Configurations >vHost** and Add the context below to vHost section.

Add Context below and edit as needed.

NOTE: DO NOT delete existing context, only scroll down to the bottom and add the new one.

The context tells OpenLitespeed to server our Nodejs app. Without the Context, it will server other normal php or html based sites without an issue.

```
context / {
  type                    appserver
  location                /home/supernode.lintsawa.com/public_html
  binPath                 /usr/bin/node
  appType                 node
  maxConns                100

  rewrite  {

  }
  addDefaultCharset       off
}
```

All Done.

Restart Openlitespeed.

**`/usr/local/lsws/bin/lswsctrl restart`**

![](https://truehost.com/support/wp-content/uploads/2024/12/image-156-1024x125.png)

Reload your site and it should be working well.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-157.png)

### **Step 4: Troubleshooting (Optional)**

In case of Any Errors, use the command below to troubleshoot and Fix them.

**`tail -f /usr/local/lsws/logs/stderr.log`**

Congrats. You've successfully hosted your Nodejs app on Cyberpanel.

Happy Hosting!
