New Node JS rewites documentation ?

wanah

Well-Known Member
#1
Hello,

You specify that the latest version of litespeed supprots proxy rewrites in hatcess for usage with nodejs.

Nodejs is easy to install with nave:

https://github.com/isaacs/nave

It would be nice to have some documentation about getting it up and running with litespeed :)
 

NiteWave

Administrator
#2
I've not tried yet. to my understanding, it's automatic and transparent to end users, it'll just work if work under apache.
if you try and still problem, please report here for developer to follow up.
 

NiteWave

Administrator
#4
yes, I think so. besides 127.0.0.1, all other IPs on this server should be supported as well.
in the past, you've to manually create a "server external app" for 127.0.0.1:XXXXX before using it in .htaccess
now, it's dynamically created.

but for IPs not on the server, I think still need create a "server external app" explicitly before using it.
just my understanging though.
 

wanah

Well-Known Member
#5
Ok, I've tested creating and external app + the .htaccess rules above and using the following code

Code:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(50000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:50000/');
However it's not usable on shared hosting just yet.

Cloudlinux needs to finish implementing virtual networking to allow users to create their own ports without affecting other users.

We would then need a cPanel plugin to allow users to lauch applications and make sure they are running and start with the server without haveing to run a cronjob to make sure it's still running (unless there is some other way to allow users to make sure a job is running…).

The page shows in the browser but if an application is stopped another user to take the first users port making the first user change his script to another port.

Another user could also show the first user's script on his own website, not sure how we would get around this ?

Litespeed would need to be detected as running as a specific user so that Cloudlinux's future virtual networking could allow to firewall off other user's ports…
 

wanah

Well-Known Member
#6
Hello,

Went one step further…

installed npm on the user account and ran npm install forever -g

Then added to user crontab

@reboot /home/USER/.nave/installed/mynode/bin/forever start /home/USER/example.js

In therory (haven't tested a reboot yet the users process should run permanently

The big question now is :

Will it be possible to run litespeed as the users docroot user in cPanel so that it can access that user's virtual ip and ports when Cloudlinux enables this feature ?

This would mean it woud be possible for a user to choose any port on his virtual IP, and to only allow listespeed for that account to run the proxy rewrite for that IP and port…

Do you think this will be possible ?
 

wanah

Well-Known Member
#8
I'm sorry I'm not sure why you are asking me to test under apache… I

t's working well here under litespeed, the only issue are the ports.

I'm quite sure if litepeed isn't running under the username it would not be able to access a nodejs process running on CloudLinux's future virtual networking that they have been talking about for some time now (don't know how long it will be before they release it).

I'm quite sure Apache doesn't allow this, but Litespeed might ?
 
Top