How to Install NodeJS on CyberPanel

How to Install NodeJS on CyberPanel

You might be wondering if it is possible to install NodeJS on CyberPanel, given that CyberPanel is usually used for PHP websites like WordPress and others.

The answer is yes. Here, we will discuss the steps to install NodeJS on CyberPanel so that your website using Node.js can be accessed.

How to Install NodeJS on CyberPanel

Before starting, there are a few things you need to know:

Now, let us start with the first step

1. Install Node.js

The first step you need to take is to install Node.js on the server via SSH. For example, for Ubuntu, you can use this command

sudo apt-get install nodejs npm

Wait until the installation process is complete before you can proceed to the next step.

2. Upload Node.js File

Now you can upload the Node.js file you created to your website domain folder. For example, since we are using a subdomain here, the folder is located at /home/wpgan.com/node.wpgan.com

3. Configure AppServer Context

After the file is uploaded, you can return to the domain or subdomain management page, then edit vHost conf and add the following lines at the very end

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

Make sure to change /home/wpgan.com/node.wpgan.com to match the Node.js installation folder you are using, then save the changes by clicking the Save button

4. Run NodeJS

Now you can access your website that uses Node.js without having to run the command npm run start or npm run dev

If the installation still fails after following the steps above, you can try restarting the server, running npm install in the Node.js installation folder, and checking the firewall to ensure the port used by NodeJS is open.

If there is already a NodeJS installation on your server and you get the error message Error: listen EADDRINUSE: address already in use :::3000, you can try changing the port of the NodeJS application you installed.

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...