ISPConfig 3 running Nginx and Nodejs?

Discussion in 'Tips/Tricks/Mods' started by GreggRed010, Mar 24, 2020.

  1. GreggRed010

    GreggRed010 New Member

    I'm looking for some information and insight into running Nodejs on my ISPConfig server running Nginx. I have multiple sites currently running from the server and I am in need of deploying a new Nuxt.js application.

    Firstly, will this be possible? If so what will I have to do in order to get it working correctly.

    Secondly will it be possible to run multiple apps and sites using node.js, simultaneously? I believe I'd have to do a reverse proxy but honestly I'm unsure.

    Any help and guidance on this matter will be greatly appreciated.
  2. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    I don't know about nginx, never really used it. but multiple websites running nodejs shouldn't be a problem. doing that with ispconfig on apache with no problems.

    I just install composer, nodejs and npm as root using apt, (everyone wanting nodejs/npm so far has always wanted composer as well) and make them available in jailkit. so ssh users can use them however they want.

    add to /etc/jailkit/jk_init.ini
    comment = NodeJS
    executables = /usr/bin/npm, /usr/bin/node, /usr/bin/nodejs, /usr/local/bin/elmi-to-json
    directories = /usr/share/npm, /usr/lib/nodejs, /usr/local/lib/node_modules
    comment = composer
    executables = /usr/bin/composer
    directories = /usr/share/doc/composer
    then just add composer and nodejs to the jailkit app list in the ispconfig server config area, and create the ssh user or update existing jailkit.

    I've never had to do anything with apache to allow any nodejs/npm stuff to work, but as I've already said, I don't know anything about nginx, so someone else will have to say if anything needs to be done there.
    ahrasis and GreggRed010 like this.
  3. GreggRed010

    GreggRed010 New Member

    Great Stuff, thank you for the detailed reply and information. Finally getting around to implementing this on my server, so fingers crossed its as straight forward on nginx as it is on apache.
    ahrasis likes this.
  4. celocore

    celocore New Member

    I followed these steps and now I have the problem that I get the following error message when I do an "npm -v" in the jailed environment.

    throw err;

    Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/share/npm/lib/utils/unsupported.js:2:14)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

    I'm running ubuntu 20.04 and my jk_init section looks as follows
    comment = NodeJS
    executables = /usr/bin/npm, /usr/bin/node, /usr/bin/nodejs, /usr/bin/semver
    directories = /usr/share/npm, /usr/share/nodejs, /usr/share/node-mime, /usr/lib/nodejs
  5. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    yeah, i've noticed the same thing on 20.04 and using ispconfig 3.2.*
    not sure if it's any changes in nodejs/npm packages and file/folder locations, or any differences in the newer jailkit init config.

    not got anyone actively using npm at the moment and i've got other things i need to work on, so trying to work out this issue hasn't been a priority for me.

Share This Page