CyberPanel Community

How to setup a express js app

an
ansina #1

I have a CyberPanel on Digital Ocean and I need to be able to create multiple sites, some of them with express js.

Maybe with some configuration in the vhost.

9 replies
an
ansina #3

That doesn’t work

an
ansina #4

I create a site, have a express in public_html/testNode.
I add the context to vhost with the correct path and have node running the express index.js. Console say that is listening to port 3030 (the one configure inside the index.js).

But when I go to the main domine I doesent load anything

an
ansina #5

Maby I need to do something with ports and the firewall or something?

Cy
CyberPanel #6

As in the NodeBB example, you don’t need to run the application via command line. That was only a test.

You can see an example here Running Node.js Apps with OpenLiteSpeed – OpenLiteSpeed

So, for example, your application resides in /home/domain.com/public_html/app/node.js

The context config should look like

context / {
  type                    appserver
  location                /home/domain.com/public_html/app/
  binPath                 /usr/bin/node
  appType                 node
  maxConns                100

  rewrite  {

  }
  addDefaultCharset       off
}

With this you can visit the NodeJs app at your root domain as the context is being set up at /

th
theHopper #7
As in the NodeBB example, you don't need to run the application via command line. That was only a test.

You can see an example here Running Node.js Apps with OpenLiteSpeed – OpenLiteSpeed

So, for example, your application resides in /home/domain.com/public_html/app/node.js

The context config should look like

context / {
  type                    appserver
  location                /home/domain.com/public_html/app/
  binPath                 /usr/bin/node
  appType                 node
  maxConns                100

  rewrite  {

  }
  addDefaultCharset       off
}

With this you can visit the NodeJs app at your root domain as the context is being set up at /

Perfectly working Thank you so much

re
rehmankhalil #8

I am trying to setup up a websocket connection using ws - npm package.

Context:

context /chat {
type appserver
location /home/domain.com/public_html/chat
binPath /usr/bin/node
appType node
maxConns 100

rewrite {

}
addDefaultCharset off
}

My https is working but i am not able to connect to websocket using ws://domain.com/chat

I can share my code if required.

Any help would be greatly appreciated. :smile:

MW
Marcelo Wan #10

I’m having trouble loading the application. When accessing the subdomain an infinite load is shown and nothing happens.

SSL work
Migration Work

See below

I’m use AdonisJs

context / {
type appserver
location /home/dominio.com/aplicativo
binPath /usr/bin/node
appType node
startupFile server.js
maxConns 100

rewrite {

}
addDefaultCharset off
}

ThankYou

Sign in to reply