This is an old revision of the document!


How to use CloudLinux Node.js Selector with LSWS

As JavaScript became one of the most popular programming languages, more and more customers demand Node.js hosting. CloudLinux Node.js Selector was introduced to facilitate the performance and functionality related to Node.js. LSWS added CloudLinux Node.js Selector support starting from 5.3RC1 release.

Node.js Selector from Cloudlinux is supported by Litespeed Web server out of the box. You will need to follow the instructions in the CloudLinux Node.js selector. You can refer to CloudLinux official documentation.

You can create file with the name index.js and content:

var http = require('http');
var server = http.createServer(function(req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    var message = 'It works!\n',
        version = 'NodeJS ' + process.versions.node + '\n',
        response = [message, version].join('\n');
    res.end(response);
});
server.listen();

Point your browser to http://domain.com/index.js

The result is:

If you see only the code of the file like this:

you need to check from cPanel → NoteJS selector if your application is start. You can start it from there or restart. If you still see only the source code make sure that your server is running Litespeed web server version 5.3 or higher.

  • Admin
  • Last modified: 2018/05/24 14:46
  • by Robert Perper