Implement a node server without using Express.js

What error are you getting ?

When I go to the http://domain.com/ it just keeps loading but when you put it on a port http://domain.com:3000 it works

Then everything worked code-wise. Check your context now/ It should look something like

context / {
  type                    appserver
  location                /home/mynodejsdomain.com/public_html
  binPath                 /usr/bin/node 
  appType                 node
  maxConns                100
 
  rewrite  {
 
  }
  addDefaultCharset       off
}

I did it and still doesn’t work. Also, it only works on http not https. On https it says 404 not found. In addition, I have no .htaccess file.

Install pm2 so that you know which errors you are running into using pm2 monit. Just go to

$ cd /home/myincognitodeployment.com/public_html
$ npm -i -g pm2
$ pm2 startup src/index.js --name "incognito" --watch
$ pm2 startup && pm2 save
$ pm2 monit

When I run

$ pm2 startup src/index.js --name "incognito" --watch

It gives me this error

Please verify that your choice is indeed your init system
 If you arent sure, just run : pm2 startup
-----------------------------------------------------------
/usr/local/lib/node_modules/pm2/lib/API/Startup.js:324
      throw new Error('Unknown platform / init system name');
      ^

Error: Unknown platform / init system name
    at API.CLI.startup (/usr/local/lib/node_modules/pm2/lib/API/Startup.js:324:13)
    at Command.<anonymous> (/usr/local/lib/node_modules/pm2/lib/binaries/CLI.js:707:9)
    at Command.listener (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:315:8)
    at Command.emit (node:events:513:28)
    at Command.parseArgs (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:651:12)
    at Command.parse (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:474:21)
    at Timeout._onTimeout (/usr/local/lib/node_modules/pm2/lib/binaries/CLI.js:206:15)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

Run it. Which server os is this ?

Now what. I did pm2 startup && pm2 save and pm2 monit

On pm2 monit monitoring screen has your app started? do you see any errors ?

no. I don’t.

It looks like this:
Screen Shot 2023-03-17 at 4.02.28 PM

Well that was futile.

Can you do a last try and reboot your server.

Open pm2 monit to check again give it like 10mins. PM2 is a Real-time Monitoring package it should track any Issues & Exceptions of any nodejs apps registered/saved on it.

Post your node version and npm version here still

still don’t work. node v16.18.1 and npm v8.19.2.

Hello, still don’t work


This person had a similar problem!

He used expressjs and his issue is different from yours. You are not trying to use Express.js you want use Incognito instead.

pls help me

I think its time you took this conversation to the Amethyst Network and since it uses Ultraviolet proxy as its primary proxy method (which is buggy - will make pages not even load) I would also recommend you just run SSG/SSR with Express.JS. There are several node fameworks supported out of the box which are more robust than incognito - AdonisJS, LoopbackJS etc

I also realized I don’t have an .htaccess file. Do I need that?

Yes if you want to force ssl or www redirection