New Node JS rewites documentation ?

Discussion in 'Feedback/Feature Requests' started by wanah, Jul 29, 2014.

  1. wanah

    wanah Well-Known Member


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

    Nodejs is easy to install with nave:

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

    NiteWave Administrator

    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.
  3. wanah

    wanah Well-Known Member

  4. NiteWave

    NiteWave Administrator

    yes, I think so. besides, all other IPs on this server should be supported as well.
    in the past, you've to manually create a "server external app" for 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.
  5. wanah

    wanah Well-Known Member

    Ok, I've tested creating and external app + the .htaccess rules above and using the following code

    var http = require('http');
    http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World\n');
    }).listen(50000, '');
    console.log('Server running at');
    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…
  6. wanah

    wanah Well-Known Member


    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 ?
  7. NiteWave

    NiteWave Administrator

    if you can test under apache and tell the difference with litespeed, will be even better. Thanks
  8. wanah

    wanah Well-Known Member

    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 ?

Share This Page