Node.js support

I was following the the instructions but at the end i get an error after i install the nodejs app but site is unreachable error 500 and on error log i get

2020/06/11 18:56:37 [crit] 950#950: *324 connect() to unix:/home/prn/web/site.com.net/nodeapp/app.sock failed (2: No such file or directory) while connecting to upstream, client: 171.50.159.91, server: site.net, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:/home/prn/web/site.net/nodeapp/app.sock:/ico", host: "site.net", referrer: "http://site.net/"

My script doesn’t have a file app.sock

Anybody able to assist with this

Any other .sock file? I am not known with NodeJS but looks quite clear…

Not sure as for me nodejs not my coupe of tea, just a request, willing to provide a fresh DO vps at disposal to find a working solution, my app has no .sock file

I hate to use C-y-b-erpanel(no advertise) purely for this, i want to be able to use my beloved hestia :slight_smile:

1 Like

Is it standaard script? Check the dist, Documentation and the install folder maybe there is some information found to how / what?

@root did you managed to get node.js working?

Hello All,

I think the issue is related to pm2 user / folder permissions
Using below code as test:
app.js

#!/usr/bin/env nodejs
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen('/home/**user**/web/**domain.domain.domain**/nodeapp/app.sock');
console.log('Server running at ');

when I ran node app.js in user folder this has created the app.sock

and if I follow the permission found inside the NodeJS.sh I could get the script within my domain.
chmod a+w "$home/$user/web/$domain/nodeapp/app.sock"

Then I followed below article so I could ran pm2 under user and when running pm2 start app.js as well successful create the app.sock
https://medium.com/@sobus.piotr/pm2-share-the-same-daemon-process-between-multiple-users-dd7ecae6197a

Now i do not know how to sort out permissions either for nodeapp folder or for the user. So this can run with NodeJS.sh under webcontrol

1 Like

@Gras Thanks for the trial, i had changed to another cp for this app, but will definitely like to get back on this and give another run, did you managed to sort out the above.

@Raphael any chance we can add this to the to do list, node.js is a great app that would do great on the future list.

Best,
G

@root to be fair my knowledge of Linux is limited. I think it might be related with permissions but could be wrong. The script NodeJS.sh does not do anything I even tried to change the command PM2 to “start” instead of “restart” nothing happened.
I did manage . Unless u run PM2 start under user domain and than adapt the command inside the NodeJS sh to change the permission this will work.

I think worth as well trying supervisor instead of pm2

@root
May i know what cp?
Thanks

agree with this :grin:

@jtdoank i use CyberPanel (no advert in any way) but is limited and buggy

@Raphael can we add this on to do list, i know is longshot but this app is quite good and becoming more and more popular.

Thanks,
G

Is there any update for Node.js support?

Hello All,
see below link might be of interest:

if you have any other guides please let me know. I have not tried above yet.

Thank you

2 Likes

Now please go again back to nginx.conf and read the first few lines of that file. Then comsider to use a template as suggested above.

@Raphael is there a way to add this to default installation, just thinking on trying again on HestiaCP with this.

You mean to create a custom.tpl file and include it in hestiacp? That makes sense to me.

You need for each port a different template it doesn’t make sense currently unless we add support for custom variables in Hestia

Other option would be an implementation like we do with php

What is the easiest way to do it? Is it worth it?

Friend, please, if you don’t mind, make a video tutorial so that the port of the localhost is 8000.