Author Topic: Installation Node.js and integration  (Read 44839 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Installation Node.js and integration
« on: June 22, 2016, 11:57:39 AM »
Here's one you might already considered questions, I search the forum, and I have not been able to find.

After almost 2 months of use Centos Web Panel, frankly I am satisfied with how it works, except that some things still do not work properly. Well, it is not an issue now.

On my vps, I have 8 gb ram, 2 core etc .. I run on php 5.6...

I installed node.js and it works well, at least as far as the console and reports that scripts are running. However, when I try to set up a specific port on the server through the firewall, I'ts just blocked. and does not allow me to open the example.example.com:8686/ node.js script.

The question is, if someone can help me to solve the problem?

A second question, Will it in future versions be somehow integrated node.js and settings for node.js such as modules for example teamspeek3 or torrent seedbox

Offline
*
Re: Installation Node.js and integration
« Reply #1 on: August 04, 2016, 08:33:50 PM »
+1

Would appreciate an implementation also.

Offline
*
Re: Installation Node.js and integration
« Reply #2 on: August 14, 2016, 08:57:58 PM »
I hope that more people will be involved.

Offline
*
Re: Installation Node.js and integration
« Reply #3 on: September 08, 2016, 09:13:05 AM »
Ok,

So i Found cgi-nodejs and i quote installation process,


Introduction JavaScript (Node.js) is becoming one of the most popular languages. For some reason today we are still using different languages to develop server side logic than client/browser logic. For example PHP on the server side and JavaScript on the browser. Why not use a single language!!!! You can share code and libraries between client and server. JavaScript is an extremely powerful language but can be tricky to use. With proper commenting and documentation the lack of structure in JavaScript can be remedied. 
This tutorial will show you how to install Node.js on one of the most populate Hosting Sites, GoDaddy.com under cPanel. This tutorial should work under any web hosting provider as long as they support custom CGI (Common Gateway Interface).
Let's get started.
Download Required FilesDownload Node.jsDownload the latest Node.js 64-bit Linux Binaries (.tar.gz) from http://nodejs.org/download/. For this beginner tutorial we will only need /bin/node file inside the downloaded tar file.
Download Node.js height=320
Download CGI-Node.jsDownload the latest CGI-Node.js from http://www.cgi-node.org/downloads. You can download the optimized version or the development version. Either will work but the optimized version will give you extra milliseconds on load time.
Download CGI-Node.js height=267
Rename the the downloaded file to cgi-node.js , open it and replace the first line <accountname> with your GoDaddy account name.Configure GoDaddyAccess cPanel and File ManagerLog into your GoDaddy account and launch the cPanel found under WEB HOSTING.
NOTE: This has only been tested with GoDaddy cPanel hosting and not the legacy hosting which they are trying to phase out.
Go into cPanel height=238

 Select "File Manager" to open the "Web Root (public_html/www)". make sure "Show Hidden Files (dotfiles)" is selected as well and hit "Go".
Upload cgi-node.jsSelect the "cgi-bin" folder under the "public_html" then click on "Upload"
Select cgi-bin under public_html height=296

This part is very IMPORTANT: make sure the file Permissions is 755 (provide Execute permissions to User, Group, and World) before uploading the file.
IMPORTANT NOTE: You will get an Apache error if the file permissions is not 755.
Upload cgi-node.js height=226

If you forget to change the permissions then you upload the file you can change them later but it is not covered under this tutorial.Upload Node.jsNow let's upload the downloaded "node" file that we extracted from "node-v0.xx.xx-linux-x64.tar". As of version v0.10.32, the file was around 11MB in size.
Navigate to "/home/<accountname>/bin" folder. Where <accountname> refers to your GoDaddy root home folder.
Ensure that the permissions is set to 755 like before and upload the "node" executable to the bin folder.
IMPORTANT NOTE: the path to this file must match the first line path in cgi-node.js otherwise you'll get an Apache error.

Adding .htaccessIf you don't already have a ".htaccess" file within public_html then create one. Open ".htaccess" file for editing.
Open .htaccess file for editing height=271

Add the following lines within the file.
Action     cgi-node     /cgi-bin/cgi-node.js AddHandler cgi-node     .jscript
Add cgi-node handler to .htaccess file height=108

NOTE: your script extensions do not have to be ".jscript" they can be whatever you want them to be as long as your server side executable scripts have the same extensions.
NOTE: only the entry HTTP request files must have this extension. You can include .js or .jscript files within your code.
We are done, let's test out the script.Test CGI-NodeCreate a new file within the public_html folder called cgiNodeInfo.jscript and add the following code within it. cigNodeInfo() function is does exactly what phpInfo() does, it outputs all the server, environment and request information to the output stream.
<? cgiNodeInfo() ?>
Save the file and navigate to it within your browser and you should see the following:
cgiNodeInfo output results
If you get an error or have any comments let me know. (Comment below)
CGI-Node is still in development and we'd appreciate any feedback or comments to make this module better.For issue tracking and reporting go to the following link: https://github.com/UeiRicho/cgi-node/issues

I know, this is for Cpanel, its not for CWP. But developer width right skill can make it happen.
i tray and create some directories and put files by instruction, and it work, i got a 500 internal server.... and does not work at all. so CAN somebody to tray??? Maybe its error when uploading files as root not like a user

Offline
*
Re: Installation Node.js and integration
« Reply #4 on: September 16, 2016, 05:09:31 AM »
I'd like to do this as well...can anyone help?


Offline
*
Re: Installation Node.js and integration
« Reply #5 on: October 01, 2016, 02:24:36 PM »
Hello guys!
First I need to apologise for my broken english. It is foreign language for me.

Almost all of the above methods is well, but on each step it has some mistakes.

So, by the topic I may give you my solution.

1. download the binaries from here https://nodejs.org/en/download/current/
2. download the cgi-node.js from here http://www.cgi-node.org/downloads
3. make the directories structure in your CWP home
Code: [Select]
/
|_ bin
|_ nodejs
|   |_ sessions
|_ public_html <it may exists by default>
    |_ cgi-bin
4. edit cgi-node.js in all places where you find D:/Programs..., first line must looks like here:
Code: [Select]
!#/home/<username>/bin/nodewithout any double quotes! In the next place on the text you must replace D:/Programs... by the /home/<username>/nodejs/sessions/ char by char all as I wrote, where <username> means your account name at the CWP
5. create .htaccess with the next content (last two lines is very useful, but it is optionally)
Code: [Select]
Action            cgi-node   /cgi-bin/cgi-node.js
AddHandler        cgi-node   .jscript
Options           -Indexes
DirectoryIndex    index.html index.jscript
6. copy .htaccess file into /public_html folder
7. copy cgi-node.js (or cgi-node.min.js) into the /public_html/cgi-bin folder
8. copy node and/or npm into /bin folder
9. make sure that all executable files (cgi-node.js, node, npm) have rwxr-xr-x (755) permissions and its folders too (chmod button in the cwp file manager)
Code: [Select]
/
|_ bin                     <755>
|   |_ node                <755>
|_ nodejs                  <755>
|   |_ sessions            <755>
|_ public_html             <755>
    |_ cgi-bin             <755>
    |   |_ cgi-node.min.js <755>
    |_ index.jscript       <755>
10. enjoy

How to check nodejs? It is very simple after all you have made before.
Make some file with .jscript extension into /public_html folder with the next content
Code: [Select]
<? CgiNodeInfo(); ?>make sure that you write right function name (in this case first letter must be big).

That's all folks ;)
« Last Edit: December 05, 2016, 01:18:37 PM by discovery »

Offline
*
Re: Installation Node.js and integration
« Reply #6 on: October 05, 2016, 06:35:28 PM »
I followed your directions exactly, and I just got an internal server error when I try to access the index.jscript file.

[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] suexec failure: could not open log file
[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] fopen: Permission denied
[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] Premature end of script headers: cgi-node.js

I double-checked the permissions, locations, etc. and everything is exactly as you specify in your directions above.

Any ideas what might be wrong?

Offline
*
Re: Installation Node.js and integration
« Reply #7 on: October 07, 2016, 11:01:57 AM »
I followed your directions exactly, and I just got an internal server error when I try to access the index.jscript file.

[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] suexec failure: could not open log file
[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] fopen: Permission denied
[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] Premature end of script headers: cgi-node.js

I double-checked the permissions, locations, etc. and everything is exactly as you specify in your directions above.

Any ideas what might be wrong?
Hello. It looks like you have problems with user permissions in CWP. Try to check user accounts/fix permissions in your CWP to set them in 755 (644 by default for new users). If you are not the administrator of CWP ask your admin to set your user privilegies.
Have a nice day.
« Last Edit: October 07, 2016, 11:29:34 AM by discovery »

Offline
*
Re: Installation Node.js and integration
« Reply #8 on: October 15, 2016, 02:12:27 PM »
I did this.

Afterwards, I had to go back and set cgi-bin/cgi-node.js to 755 manually, using Filezilla. I made sure all the executable files were 755. But cgi-node-js was the only file whose permissions I had to modify.

I made sure every file had the right permissions, per your directions. I know how to use the "change file/folder permission" feature in my FTP client, Filezilla.

Any other ideas?

Offline
*
Re: Installation Node.js and integration
« Reply #9 on: October 20, 2016, 10:41:32 AM »
Hello. May be my english has problems (sorry again), but here is that I meant in one picture.



Check it.

BTW: In cgi-node.js try to replace process.exist() by process.exit(). It is important if you get a script not from github.

I hope it will work.

Have a nice day.
« Last Edit: October 28, 2016, 12:11:10 PM by discovery »

Offline
*
Re: Installation Node.js and integration
« Reply #10 on: October 27, 2016, 06:28:12 PM »
The picture is not there. Can you re-post it please?

Thanks,

Matthew

Offline
*
Re: Installation Node.js and integration
« Reply #11 on: December 02, 2016, 01:14:10 AM »
This is the error I'm getting now (from my error_log)

suexec policy violation: see suexec log for more details
Premature end of script headers: cgi-node.js

Then I change "cgi-bin/cgi-node.js" to 755, and I start getting this bundle of errors again:

[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] suexec failure: could not open log file
[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] fopen: Permission denied
[Wed Oct 05 13:34:48 2016] [error] [client 1.1.1.1] Premature end of script headers: cgi-node.js

Again, I would like to emphasize that I have followed your directions carefully. I started over today, doing everything according to the directions. Same result! I have a standard CWP install on my own hardware; I have full admin privileges.
« Last Edit: December 02, 2016, 01:42:18 AM by DeveloperMcD »

Offline
*
Re: Installation Node.js and integration
« Reply #12 on: December 05, 2016, 12:59:47 PM »
Hello.
It all looks like you have the same problem with permissions of your directories and files. Make sure you have set 755 on all places where it is needed.
In my case it is:
Code: [Select]
/
|_ bin                     <755>
|   |_ node                <755>
|_ nodejs                  <755>
|   |_ sessions            <755>
|_ public_html             <755>
    |_ cgi-bin             <755>
    |   |_ cgi-node.min.js <755>
    |_ index.jscript       <755>
SuExec policy violation exception (in all resources I have read) means exactly that problem! If you are have administrative permissions, you can find a suexec.log file maybe it has an answer to all your problems. Or (in a bad case) you need to read this manual carefuly. I have no other thinks.
« Last Edit: December 05, 2016, 01:02:15 PM by discovery »

Offline
*
Re: Installation Node.js and integration
« Reply #13 on: March 09, 2017, 02:58:05 AM »
Discovery,

I appreciate your effort to help, but unfortunately it didn't solve the problem.

Anyone else have any ideas?

Node.js is a huge, popular platform; it's a shame I can't use it on my CWP server.

Matthew

Offline
*
Re: Installation Node.js and integration
« Reply #14 on: June 02, 2017, 09:42:05 PM »
I have not been active for some time, of course, I'll be back in the saddle.
Tomorrow I will try to solve the problem.

However, for now the fastest sites are in NODE JS, and you must tray GHOST :) for bloging :)