Struggling to deploy my Node.js website

and when I change the IndexFile in the vHost Conf to ‘app.js’, the preview link and my domain just shows the ‘app.js’ code:

Share full vhost conf here

context / {
type App Server
location /home/
binPath /usr/bin/node
appType node
startupFile app.js
maxConns 100

rewrite {

addDefaultCharset off

Replace context by this one.
This is last reply for you and sure it will work

Here is my vHost Conf file with the changes made:

docRoot $VH_ROOT/public_html
vhDomain $VH_NAME
vhAliases www.$VH_NAME
adminEmails [email protected]
enableGzip 1
enableIpGeo 1

errorlog $VH_ROOT/logs/$VH_NAME.error_log {
useServer 0
logLevel WARN
rollingSize 10M

accesslog $VH_ROOT/logs/$VH_NAME.access_log {
useServer 0
logFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-Agent}i””
logHeaders 5
rollingSize 10M
keepDays 10
compressArchive 1

index {
useServer 0
indexFiles index.php, index.html

scripthandler {
add lsapi:sicil5304 php

phpIniOverride {
php_admin_value open_basedir “/tmp:$VH_ROOT”

extprocessor sicil5304 {
type lsapi
address UDS://tmp/lshttpd/sicil5304.sock
maxConns 10
initTimeout 600
retryTimeout 0
persistConn 1
pcKeepAliveTimeout 1
respBuffer 0
autoStart 1
path /usr/local/lsws/lsphp81/bin/lsphp
extUser sicil5304
extGroup sicil5304
memSoftLimit 2047M
memHardLimit 2047M
procSoftLimit 400
procHardLimit 500

context / {
type App Server
location /home/
binPath /usr/bin/node
appType node
startupFile app.js
maxConns 100

rewrite {

addDefaultCharset off

module cache {
storagePath /usr/local/lsws/cachedata/$VH_NAME

With the changes I still get the 404 error.

domain is your domain? Or replaced with your domain?

it is replaced with my domain. I have checked and it is spelled correctly.

Could it be any conflict with the IndexFile towards the beginning of the code having “index.php, index.html”?

All this code was there by default and only made the changes you recommended?

There is no sense to keep or delete index file if you have context / .
But you may delete the cache moudle or replace app.js content from this post Running Node.js Apps with OpenLiteSpeed – OpenLiteSpeed

I really appreciate your support and help so far.

I have made some changes using the link you sent but my local server that I used to test the app doesn’t even start with this error:

const server = http.createServer((req, res) => {

TypeError: http.createServer is not a function

I am unable to find the solution to this through other forums.

My app.js file now looks like this:

import express from ‘express’
const app = express();
import path from ‘path’
import { fileURLToPath } from ‘url’;
import { dirname } from ‘path’;
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
import bodyParser from ‘body-parser’
import cookieParser from ‘cookie-parser’
const http = (‘http’);
const hostname = ‘’;
const port = 3000
import Sequelize from ‘sequelize’
import sequelize from “./config/database.js”;
import ejs from ‘ejs’
import ejsLint from ‘ejs-lint’
import expressLayouts from ‘express-ejs-layouts’
import mainRoutes from “./routes/mainroute.js”;

//app.get(‘/’, (req, res) => {
// res.send(‘Hello World!’)

app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, ‘/public’)));

// Connect all the routes to my app

// EJS
app.set(‘views’, path.join(__dirname, ‘views’));
app.set(‘view engine’, ‘ejs’);

// Test connection to database
.then(() => {
console.log(‘Connected to database successfully.’);
.catch(err => {
console.error(‘Unable to connect to the database:’, err);

.then(() => {
console.log(‘Tables created if it does not already exist’);
}).catch(err => {
console.log(‘Table has not been created’);

const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader(‘Content-Type’, ‘text/plain’);

app.listen(port, hostname, () => {
console.log(Server running at http://${hostname}:${port}/)