How to run/work with production mode for NodeJS Apps

Important - Before running your app in production mode, kindly test your app in development mode first. Only after extensive testing, you may then use the production mode.

Step 1 : Log into N99panel. From under N99panel dashboard, click 'Node Apps'


Step 2 : Now click 'Link a Node App


Step 3 : Fill in the form as under

Important points :

  1. Select the User/VHost (website)
  2. Enter the ‘App Web path’ . This would be like /app1 or /app2 or it can even be the website root i.e. /
  3. Enter the ‘App Port’ . The port entered under should be within the range of 40000 to 50000
  4. Select the ‘App Mode’. This should be ‘Production’ variant - here in this example we have choose 'Production (node)' i.e. the app is fired with node command
  5. Under the production filesystem path, enter the folder containing the app w.r.t. /home/{username}/node_apps/ . So in our case it is app1
  6. Also finally select the Nodejs version that you wish to use with the App

In production mode the Node app runs w.r.t. system path reference. To put it simply you need to ensure that any file references in your code, are absolute and not relative. Lets say your Node app start point is /home/user1/node_apps/app1/server.js , and your server.js refers to contents.json , you would need to change it to /home/user1/node_apps/app1/contents.json .

With the above steps, you have mapped the web-server's VHost/Website’s URL part to the to the specified port of the App, which will be launched by our environment from the specified source folder

To manage the App process, you can do the same from within Node Apps → App : Manage App State