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).
You would need to enable mod_proxy on apache Debian: Code: a2enmod proxy proxy_http service apache2 restart Centos change your httpd.conf and uncomment Code: LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so Do the following settings to your proxy.conf in modules folder Code: ProxyRequests Off You can then add the following line as example to any websites additional http options field: Code: ProxyPreserveHost On ProxyPass /node http://127.0.0.1:8000/ Finally run your node.js server like Code: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Apache!\n'); }).listen(8000, '127.0.0.1'); 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. Code: switch(req.headers.host) { case 'example.com': res.write('<h1>Welcome to example.com</h1>'); break; case 'not.example.com': res.write('<h1>This is not example.com</h1>'); break; default: res.statusCode = 404; res.write('<p>We do not serve the host: <b>' + req.headers.host + '</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 RemoteIPInternalProxy 127.0.0.0/8
Thank you for sharing this little HowTo. Would love to have a way to create such nodejs support via ISPConfig. Is such a feature planed? Seems there are only need a few steps to implement it into iscponfig: Cerate a Section in ispconfig to allow permitted Users (Permission by choosen Customer-Plan) to create 1 node instance A config-area for Customers with following fields: - A switch to choose, if run nodejs at Standalone (Port 80 via Proxypath Setting in Vhost), or unpreveliged Port. - [if choosen unpreveliged Port]: to reserve choosen node-port or suggest another one if port still in use - a field to enter the node.js Filename to be able to start, monitor and stop the process via ispconfig May this be possible, or does i miss some 'make it impossible' arguments?
Managing node.js servers like that would be pretty similar to how php-fpm or hhvm daemons are handled now. Of course there would be some differences to work out, but same architecture, I believe. After putting thoughts together on that, you might file a feature request in gitlab.
I have installed nodejs and have a working website, the apache directive in the options didn't work. I have put .htaccess file with below content in web folder of the website where default index.html file is. PORT_NUMBER is the listening port of the node app. RewriteEngine On RewriteRule ^$ http://127.0.0.1:PORT_NUMBER/ [P,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ http://127.0.0.1:PORT_NUMBER/$1 [P,L] I have also installed postgresql to use with nodejs app. Installed pgadmin4 to manage pgsql separately. the setup works perfectly fine. I hope this helps others.