BTC: 3B74XpJ12oucMsEgxVbZqwYd6XPgGs8GXt / ETH: 0xae7d573142e3b918cc9d2b0bf35a5f9cb35619e3

Tuesday 31 January 2023

Setup Express.js Application on CyberPanel/OpenLiteSpeed

 express js cyberpanel 1

Setup Express.js Application on CyberPanel/OpenLiteSpeed 1766×442 13.7 KB

Express.js is a web application framework for Node.js. We’ve written quite a few articles on running multiple Node.js based applications in past because OpenLiteSpeed recently had native support to run Node.js based applications without doing any reverse proxy, this gives a great performance improvment.

Today we will specifically see that how we can run Express.js Application on CyberPanel using the feature provided to us by OpenLiteSpeed.


Step 1: Install CyberPanel and Create Website

You first need to install CyberPanel 78 and create your website 76. Skip this step if you have already done so. You can also issue SSL 27 for this website.

Note: In this example we will use 109 as example domain, replace it with your domain whereever applicable.

Step 2: Install Node.js via Command Line

Next step is to install Node.js via command line.


yum install nodejs


apt-get install nodejs

Step 3: Setup basic Express.js Application

We will now set up basic Express.js application in the document root of our selected domain above (

cd /home/

## npm init will be asking some questions, you can leave them all to defaults

## by pressing ENTER/RETURN

## For entry point please use app.js

npm init

## Finally install Express.js

npm install express --save

Create an app.js file containing Hello World application in /home/ with following content

const express = require('express')

const app = express()

const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening on port ${port}!`))

Save this file, and for once click Fix Permissions from File Manager as you was doing all operations through command line so correct permissions needs to be in place.

fix permissions

Setup Express.js Application on CyberPanel/OpenLiteSpeed 21302×638 33.9 KB

Step 4: Setup AppServer Context to Serve Express.js Application

Open website launcher by visiting https:// < IP Address >:8090/websites/ and click vHost conf to add the context configurations.

FireShot Capture 5 cybertronproject.c https 8090 websites cybertronproject

Setup Express.js Application on CyberPanel/OpenLiteSpeed 31366×1849 208 KB

Finally add this code to the end of the vHost Conf File as shown below:

context / {

  type                    appserver

  location                /home/

  binPath                 /usr/bin/node

  appType                 node

  maxConns                100


  rewrite  {



  addDefaultCharset       off


Click Save and your Express.js app should be running in the brwoser.

No comments:

Post a Comment