Search code examples
node.jshostingrootputtygodaddy-api

Deploying NodeJS to godaddy


I have a domain on godaddy, and a Economy Linux Hosting with cPanel. I wanted to host a NodeJS app. Searching the web I learned I needed an application manager that I couldn't find In my Software section on cPanel.

I contacted support to learn that I need to upgrade in order to have the application manager and WHM access.

yet the support told me that I can still deploy without any of that but the support doesn't cover it.

I have putty access and i went through the trouble of installing nvm and having the GLIBC_2.16' errors.

How can I deploy a NodeJS app from a repository using Putty to my domain without paying the money to have root acces to my server.

Update

So I was able to install node using nvm using:

  • wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

I used this very useful article "https://www.codepunker.com/blog/how-to-install-node-js-and-npm-on-a-shared-cpanel-whm-hosting-account"

From there install any version of node using nvm install vxxxxx but every time I login using ssh I get the libgc2.16 error and I have to use nvm use v10.0.0 for example to have node.

The problem now is since I have node working on my hosting server. Is there a guide to how to access my node website from my domain?

Update

So, I got to running my app by uploading it to /public_html and adding a .htaccess in the same directory with the following inside it:

RewriteEngine on
RewriteRule (.*) http://localhost:3000/$1 [P,L]

then I had the problem of Cannot GET /index.html.var which I solved by adding

DirectoryIndex disabled

to my .htaccess file

Now I'm stuck with my server crashing every 5 minutes were I have to login to my terminal type : nvm use v10.0.0 to be able to start my server or else I'll have the following:

node: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by node)

How can I solve that?

Update

I solved this using nvm alias default v10.0.0

Now my server keeps crashing when ever I lose connection to my cPanel seccion.

How can I solve that?

Update

So installing forever seems to do the trick:

npm install forever -g and in my public_html directory I did: forever start app.js

Will close the question once I make sure the problem is solved.


Solution

  • Node has portable binaries that you can find here: Latest version (Node 16.2), LTS (Node 14.17). They include the binaries for node, npm and npx.