Submitted by webteam on Mon, 06/27/2016 - 18:25 Pro Licensee
I wanted to use the nodeJS script installer but have several issues/problems with it. This might be based on the fact that there seems to be no documentation on this. Pretty hard to understand things then. (Problem 1)
- So I went to the script installer section and installed it.
- I tried to install it in the root directory of my webspace, but it got installed in the public_html directory. (Problem 2)
- I found the server.js and found out it is running on port 3000
- Tried to access it by using domain.com:3000. I got a Connected reset error. (Problem 3)
- Most severe issue: Apache was stopped after nodeJS was activated on one server and couldn't be restarted! (Problem 4) It was needed to uninstall the installed nodeJS script using the script installer to get Apache running again.
Btw: Is there any way to allow the use of npm?
Could you please tell me how to use it properly or fix the problems reported?
Status:
Closed (fixed)
Comments
Submitted by andreychek on Mon, 06/27/2016 - 18:45 Comment #1
Howdy -- the Install Scripts can only be installed into public_html, and sub-folders under that. When it mentions installing it into the top-level, it's referring to the public_html folder.
Regarding the errors you're seeing --
Do you see any errors in /var/log/apache2/error_log around the time that you were trying to start Apache? Also, what about in $HOME/logs/error_log?
Those may contain some clues as to why Apache wasn't starting up (we'll get to the other problems you shared shortly).
Submitted by webteam on Fri, 07/01/2016 - 10:01 Pro Licensee Comment #2
Is it really a good idea to install node and node scripts into a public directory, where you might be able to download these scripts? I think it is not. That seems to be a potential (security) risk...
That's what is in the /var/log/apache2/error_log for the relevant time frame:
And from /home/m-mohr/logs/error_log:
I think I installed nodejs around 00:37. At 01:09 / 01:12 I was trying to restart the Apache server.
I'm eagerly awaiting your response.
Submitted by andreychek on Fri, 07/01/2016 - 10:09 Comment #3
Ah, it looks like there is a missing Apache module.
Try running this command:
a2enmod lbmethod_byrequests
And then restart Apache.
After that, are you able to setup NodeJS?
Submitted by webteam on Wed, 07/06/2016 - 10:48 Pro Licensee Comment #4
Yes, that helped. Now apache and NodeJS are running side-by-side. So this module should be enabled by default (by the installer?) when Virtualmin is running, right?
Seems Problems 2 and 3 are also solved by this. The directory redirects all requests to node and the file in the directory can't be downloaded as expected, right? A port doesn't needs to be specified to.
So the serious problems are solved.
Is there a way to let users use npm via SSH to install scripts? Is there any documentation on the nodeJS stuff and how it is implemented / to be used in Virtualmin?
Thank you.
Submitted by andreychek on Fri, 07/08/2016 - 09:30 Comment #5
Yeah it sounds like a bug that this particular module isn't enabled at installation time; I'll talk to Jamie when he returns from traveling about having Virtualmin set that up automatically.
But yes it shouldn't be a problem to have users use npm.
The Virtualmin installer just installs NodeJS into the specified directory -- once that's done, it should then act like any manually installed version.
If you have any questions regarding the setup, we'd be happy to answer them... and we'll make a list of what your questions are, and perhaps create some documentation on that within Virtualmin.
Submitted by JamieCameron on Fri, 07/08/2016 - 19:58 Comment #6
Oddly, I never ran into the problem with this missing module during my testing. I will update our installer to enable it.
Submitted by JamieCameron on Fri, 07/08/2016 - 19:58 Comment #7
Submitted by webteam on Mon, 07/11/2016 - 05:11 Pro Licensee Comment #8
Thank you! Some (user) documentation on how to use NodeJS and NPM with Virtualmin would be highly appreciated.