NodeJS with ISPconfig3

Discussion in 'Tips/Tricks/Mods' started by Poliman, Mar 11, 2016.

  1. Poliman

    Poliman New Member

    I would like to install NodeJS on the server on which is ISPconfg3 installed. After this I would like to configure this with ISPconfig3 - redirecting (specific element of - etherpad editor, which use nodejs) customer's site to nodejs. Site will be created by ISPconfig3, then files will be uploaded via ftp on server. On my server ISPconfig3 cooperate with apache. Should I install nodejs as newly created user each time when I setup new website for user?
    Generally - how to add nodejs to a server managed by ISPCFG3 and then redirect a specific customer's site to node.js (the server is using apache).
  2. Active Member

    You would need to enable mod_proxy on apache

    a2enmod proxy proxy_http
    service apache2 restart
    Centos change your httpd.conf and uncomment
    LoadModule proxy_module modules/
    LoadModule proxy_http_module modules/

    Do the following settings to your proxy.conf in modules folder
    ProxyRequests Off
    You can then add the following line as example to any websites additional http options field:

    ProxyPreserveHost On
    ProxyPass /node
    Finally run your node.js server like
    var http = require('http');
    http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello Apache!\n'); 
    }).listen(8000, '');
    If you need multiple node.js instances depends on what you're going to do / allow node.js to do - not my topic.
    But you could implement vhost like behaviour if you need to.
    switch( { 
    case '': 
    res.write('<h1>Welcome to</h1>'); 
    case '': 
    res.write('<h1>This is not</h1>');
    res.statusCode = 404; res.write('<p>We do not serve the host: <b>' + + '</b>.</p>'); 
    } res.end();
    Good luck.
    Oh and if you need the real IP beeing passed trough:
    Enable mod_remoteip ( adopt the how to from above ) And add the following to the http options for your website
    RemoteIPHeader X-Forwarded-For
    till and Jesse Norell like this.

Share This Page