How to Configure and Deploy CloudLinux’s Node.js Selector

Why Node.js for CloudLinux?

In the last few years, the stability and ease of use of Node.js has lead to heavy adoption in application development.  However, deploying and configuring a Node.js application to work with cPanel presents a number of hurdles. CloudLinux’s recently released Node.js Selector is a great solution that includes a graphical interface to make deployment go more smoothly. To use this utility, you will need to have CloudLinux installed along with the LVE Manager plugin. In this configuration, your Node.js application will also benefit from the resource usage monitoring that comes with the CloudLinux LVE Manager.

Step 1 – Installation of Phusion Passenger

We’ll need to enable Phusion Passenger for EasyApache. In Web Host Manager, navigate to EasyApache.  From there, in the upper left corner of the screen type in “EasyApache 4”.  Select “Customize” in the menu that follows and then “Apache Modules”. In the list of Apache modules searching for “Passenger” will bring up the option to install mod-alt-passenger as shown below:

After selecting mod-alt-passenger, all that needs to be done is to skip to the “Review” step on the left sidebar and click “Provision” on the review menu to apply the changes.

Step 2 – Installation of CloudLinux Node.js Selector

To start the installation of Node.js Selector for your users, proceed to the LVE Manager page in Web Host Manager. Under the Options tab, click on the Node.js line to expand the section containing the install menu for the various Node.js versions:

Only the Node.js versions installed here will be available for each cPanel user. So for each Node.js version, first click “Install” to put in place the needed packages. Then, select the “Enable” switch for each version of Node to make it available. Once each version you would like to use is installed and enabled, be sure to also enable the overall toggle switch where it says “Node.js” to make the system available for your users.

 Post-installation,  with everything in place, the install menu should look like this:

Step 3 – Web Host Manager (WHM) Configuration:

At this point, you’ll have the LVE Manager configured, as well as Node.js setup for your cPanel users. However, the default cPanel memory limit is sometimes insufficient to install Node.js packages using NPM.  It is recommended to increase this memory limit to avoid issues during deployment. To make the change in WHM, proceed to the “Tweak Settings” page, and search for “Max cPanel process memory”.  Increase this from the default of 768MB to at least 1024MB to avoid issues with the NPM installer.  This setting does not affect the memory allocated to a Node.js application, but it does allow for the initial installation of Node.js packages to make use of additional memory needed for dependency resolution. Once the change is made, the Tweak Settings page will show the updated limit in the System section:

Step 4 – Version Control with Git

Before we can configure your Node.js application, the first step is getting that application on your server. There are a few options. You can use FTP to upload the copy of your application to your server, or you can use cPanel’s native Git support to clone the repository onto your server and deploy from there. Either method meets the requirement to get the application onto the server. In this example, we’ll be using cPanel’s native Git support to clone the application onto your server and then deploy it.

Within the cPanel user account that you’d like to host the application on, under the “Files” tab, select the “Git Version Control” option. This will bring you to a page where you can create a Git repository. In this example, we’ll be using the https://github.com/socketio/chat-example repository to deploy a simple chat application.

To keep your application data secure be sure not to clone or upload into the public_html folder since this makes the code itself potentially accessible from the web. CloudLinux strives to keep your data safe, and during deployment, it’s not a requirement that your application data be publicly accessible.

Here’s an example of the Git page, before the clone is completed.

Once you click on “Create” this will bring you back to the repository page showing the full path of the application being deployed. This page is important, so save that path for later.

Step 5 – Application Configuration

With the application files in place on the server, we are ready to configure Node.js to launch that application from the web.  From cPanel on the same account under the “Software” tab, select “Setup Node.js App”. On this setup screen, you’ll select “Create Application” to bring up the options for choosing the Node.js version as well as whether to use a Development or Production environment.

Notes on Choosing Development vs. Production:
Development generally has different application hooks in the code of the application, depending on how this environment variable is set. As a general rule, Production is going to have more levels of caching, as well as minimal logging. So, for a Development environment set, you can expect the inverse, with fewer levels of application caching, and more verbose logging and error message output.

Example: In production, you may only see an error page, but in development, you may see a full stack trace on an application error, letting you know exactly where the error took place inside the code.

Here’s an example of an application that’s ready to be saved:

Node.js applications, in general, depend on several environment variables. These can be added by using the “Add Variable” button near the bottom right of the page. Your Node.js production or development variable is already set separately in the top section using the “Application Mode”, so it is not necessary to set it again in the Environment variables section.

This same menu is where you can select the version of Node.js that you’d like to use as well as the application’s startup file. This might be index.js, app.js or any number of variations; it depends on the application.

Once you’ve saved your application, you’ll need to resolve its package dependencies.  The NPM package manager does this automatically based on the package.json file packaged with the application, so all that you’ll need to do here is click on the ‘NPM Install” button.  (This step will require your domain to resolve to an IP address, or the installation script will have an error) . NPM will read the contents of the package.json file and install the needed packages into a virtual environment specific to the application.

If you are familiar with the command line, you can follow the instructions at the top of the page to gain access to the “npm” and “node” commands to make additional changes manually, allowing for a great deal of customization: 

Step 6 – Application Deployment

By this point, you’ll have your application configured and Node.js modules installed, so you’re ready to launch the application! CloudLinux makes this very easy: on the same page where you configured your application, click “Run JS Script”. This will execute the application startup file that you defined earlier during setup. As Node.js applications have several different options, this can bring up another menu with different options to select depending on the application that you’re running. In general, you’ll want to select the “Start” option next. Finally, you can select the “Open” option to visit your page, and see your application!

CloudLinux’s Node.js Selector has many advantages over manual deployment.  It allows for several different applications to be run under the same user, accessed under the “Setup Node.js App” page in your cPanel account. Phusion passenger is used for application handoffs, so you won’t need to set up any .htaccess redirects to tell the web server to forward to the applications port.  With Node.js Selector this is all handled for you.

Node.js Selector and CloudLinux do not support Litespeed’s Web server, nor NGINX at this time. As always, if you’d like to have us configure and install this software on your Liquid Web server, please open a ticket or a chat with our Heroic support team!

Enabling Let’s Encrypt for AutoSSL on WHM based Servers

With the recent release of cPanel & WHM version 58 there has been the addition of an AutoSSL feature, this tool can be used to automatically provide Domain Validated SSLs for domains on your WHM & cPanel servers.

Initially this feature was released with support provided for only cPanel (powered by Comodo) based SSL certificates, with the plans to support more providers as things progressed. As of now, cPanel & WHM servers running version 58.0.17, and above, can now also use Let’s Encrypt as an SSL provider. More information on Let’s Encrypt can be found here. Continue reading “Enabling Let’s Encrypt for AutoSSL on WHM based Servers”

MySQL Performance: Converting MySQL to MariaDB

As we explored in our previous article of our MySQL Perfomance Series: MySQL vs. MariaDB there are very few downsides to using MariaDB over standard MySQL. Our high-availbility MariaDBs have proven itself to be a worthy successor with easily migitated drawbacks.  As the last article in our series we will focus on upgrading to various MySQL and MariaDB version on the following servers:

CentOS 6/7

Ubuntu 14.04/16.04

Continue reading “MySQL Performance: Converting MySQL to MariaDB”

Upgrade PHP 5.6 to 7


PHP is a programming language that can run with Apache or Microsoft IIS and works with your server to execute the requests that make up your website. 88% of online sites run on, soon to be vulnerable PHP 5.X technology. At the close of this year, scheduled by Dec 31, 2018 security support will end for our dear old friend PHP 5.6, meaning bugs and security fixes will not be tended to and could lead to security vulnerabilities. 
Each PHP version gets supported actively for two years while the third year only gets critical security updates. Luckily, the PHP gods had smiled upon us and extended the life for just a year longer than the typical PHP version before giving us the new year deadline. For all of you developers out there wanting to know exactly what is changing, here’s a helpful migration guide from PHP 5.6 to PHP 7.X.

Continue reading “Upgrade PHP 5.6 to 7”

Redirect to HTTPS

Google just announced that starting July 2018 Chrome, their very popular web browser, will start alerting for all websites which are not using Secure Sockets Layer, or SSL encryption. This is huge. The ramifications of such an alert could be quite impactful to traffic, to websites, and especially for the average user. So, what does that mean for you? More importantly, what can you do about it? No worries! Liquid Web has you covered. Continue reading “Redirect to HTTPS”

Using Object Storage for cPanel Backups

Object Storage is simply the easiest, most cost effective and secure backup solution for your data!

What are backups?

A backup is simply the procedure of making extra copies of your data in case the original data is lost or damaged. Liquid Web understands that your data is invaluable and so, we have provided a stable, secure and cost effective product called Object Storage which makes managing your cPanel backups much easier.

Continue reading “Using Object Storage for cPanel Backups”