Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:cloudlinux:node.js_selector [2018/05/24 16:23]
Lisa Clarke Proofreading
litespeed_wiki:cloudlinux:node.js_selector [2023/03/25 13:38] (current)
Lisa Clarke Redirect to new Documentation Site
Line 1: Line 1:
-====== How to Use CloudLinux Node.js Selector with LSWS ====== +~~REDIRECT>​https://​docs.litespeedtech.com/lsws/cp/cpanel/​cloudlinux/​#​rubypythonnodejs-selector~~
- +
-As JavaScript became one of the most popular programming languages, more and more customers demanded 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 the 5.3RC1 release. +
- +
-There is virtually no downside to using this method. ​ All of your existing Node.js packages which can include Ghost or any homegrown software, will run with virtually no changes through the Litespeed port.  Litespeed continues to serve all of your non-Node.js traffic and it will now additionally service the Node.js traffic. +
-===== LSWS Node.js Selector Support Out of the Box  === +
- +
-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 the [[https://​docs.cloudlinux.com/index.html?​node_js_selector.html|official CloudLinux documentation]]. +
- +
-===== How to Test Node.js with LSWS ===== +
- +
-You can create a file with the name ''​index.js''​. Place the following content in the file: +
- +
-<​code>​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();​ +
-</code> +
- +
-Point your browser to ''​http:​//​domain.com/​index.js''​. +
- +
-The result: +
- +
-{{:​litespeed_wiki:​cloudlinux:​nodejs.png?​400|}} +
- +
-Note that any port specifications in the listen function are ignored. ​ The server is processed by the Node.js function of LiteSpeed automatically. +
-===== Troubleshooting ===== +
- +
-You may only see the code of the file like this: +
- +
-{{:​litespeed_wiki:​cloudlinux:​nodejstb.png?​400|}} +
- +
-Navigate to **cPanel > NodeJS selector** and check if your application is started. You can start it from there or restart it. If you still see only the source code make sure that your server is running LiteSpeed Web Server version 5.3 or higher.  +
- +
-You can also verify that the '​Litespeed Node.js Service'​ is running. ​ From a command prompt enter: +
-<​code>​ps -ef|grep Node</code> +
- +
-One of the displayed running processes should be <​code>​Litespeed Node.js Service</​code>​ +
- +
-When troubleshooting,​ you may want to bring up a stand-alone Node.js server and verify that the software works through //that//, to be sure that the problem is not in the Javascript itself. +
  • Admin
  • Last modified: 2018/05/24 16:23
  • by Lisa Clarke