Why node.js can't run on shared hosting? [closed]
Asked Answered
P

6

61

First thing: I searched all of the known web hosting companies for shared hosting of nodejs but I didn't find anyone. Then I came to know that nodejs cannot run on a shared host system. I want to know why?

Second thing: I am a normal guy with a normal budget. Choosing a vps or deicated server or cloud hosting makes the node run, but its out of my pocket money range as compared to the PHP shared hosting services, so should I learn node.js?

Picaresque answered 8/7, 2013 at 14:47 Comment(3)
Gandi offers that — wiki.gandi.net/en/simple/instance/nodejs and gandi.net/hosting/simple?language=nodejs&db=mysqlLordan
Yes, it can! See my answer.Sainfoin
Try this solution medium.com/p/52e12a62a259/responses/showCoulombe
A
29

Theoretically it can, but practically it depends on hosting provider to have such infrastructure in place.

Node comparing to classic web platforms is self-sustainable platform. In case with PHP (for example), it runs on with of apache or nginx (or any other), and PHP it self is just script language with some libraries that does not do much apart of logic implementation, and requires web server solution. Web server creates socket to listen specific ports for traffic, will do its own magic and will execute PHP to process requests.

In meantime node.js creates own socket, and binds it to own port. That gives it much more low-level access, so it is web server it self. You can't bind to one port two applications, so it already unsharable.
There are services (web servers) that allow you to create proxy to route traffic to your node.js process but that is not as efficient in some cases, and shared hosting does not provide such functionality.

As node.js is still fairly young as well as is well, different, it still did not hit majority of shared hosting services. There are some available services online to host your node.js applications in a 'shared' manner.

Additionally you can rent EC2 Micro instance on AWS for free (Free Tier) for one year, which gives you plenty possibilities and time to try and test different stuff. You'll get semi-dedicated system, where you can do pretty much anything (install software, modify OS configurations, and much more), where shared hosting would not allow you to do so.

Ashlan answered 8/7, 2013 at 15:6 Comment(6)
This answer is wrong. You can run Node.js on top of both Nginx and Apache. In fact, both of those servers are frequently used to reverse-proxy to Node apps. For example, see the writeup on using nginx with node here. The reason why PHP is much more common on shared hosting is because its been around for longer. Node was released in 2009, PHP has been around since 1995. In this time hosts have had time to implement support, and haven't had much reason to bother supporting other languages.Milium
Hello @slang800. You missed the point of the question here. And the point is: Shared Hosting + Node.js. By "Sharing Hosting" means - any classic sharing hosting like godaddy, etc. They do not allow you to install any software stack on shared space - they only provide ready solutions. And explanation of why is that is just above. While what you are saying is different story, and in fact shared hosting platforms already enabling node.js as part of their product list they can provide service for. But it is still long way to go. Is nothing to do with proxying here. Totally different story.Ashlan
I'm not saying that Node.js can be run on shared hosting, that is obviously not true right now. I'm saying that the explanation in the answer (that it can't be run under Nginx or Apache) is wrong, because it can. Node.js isn't fundamentally unable to be used in a shared environment for a reason like it "creates [its] own socket". It just hasn't been setup to work in a shared hosting environment yet, because it's fairly young.Milium
In fact it cannot be run as part of solution that nginx or apache provides. As example check PHP - which all is - scripting language with solution, in fact php-fpm is separate process and uses socket to communicate with nginx. But php-fpm it self does not do much without nginx. It is initially made to be used with. It cannot do same job without nginx, as it does not implement http server and all web related technology stack. When node.js does, and is fully independent solution. Of course you can proxy from nginx to node - that is what I personally do. But talk here is about SHARED hosting.Ashlan
In fact answer Did mentioned about proxying. And now I've corrected it to reflect more recent situation.Ashlan
FYI, AWS EC2 which Amazon claims to be free is not completely free. I started using it 6 months ago, after second month itself they started charging around 2$ as maintenance cost (increases in upcoming months). However charges are minor but keep watching your billing dashboard.Disgraceful
D
12

There are other ways to deploy node.js apps.

You can use PaaS services, like Openshift, Heroku, AppFog, Paastor, dotCloud etc.

Deepseated answered 8/7, 2013 at 14:51 Comment(0)
C
12

Look into Heroku. For simple low traffic apps, they are free and can easily be scaled for more traffic (for an added cost). Additionally, you use Git to deploy, so is really simple to get stuff updated...

Coincidental answered 8/7, 2013 at 15:32 Comment(0)
A
5

Other great node app hosting options include Joyent's SmartOS and Microsoft Azure. Both have a free trial period.

Azure can be a great learning platform for node.js as you can host your node app in Windows Server, Ubuntu Linux, or Azure's special "web site" shared deployment scheme.

http://www.windowsazure.com/en-us/develop/nodejs/tutorials/create-a-website-(mac)/

Another cost efective solution for node app hosting is Azure's "Web Site" approach - about $10 per month. The down side is that you have to use their shared environment that hosts your node app via IIS. In practice, this worked for well for me, but you are limited in that you can't use certain Linux functions from Node when it's running on Windows, and you won't learn how to configure the node service yourself, which may or may not be important to you. (Note: Azure's GIT deployment process works great if you want to deploy your app from a local GIT repository. Also note that NodeIIS will stop your node app when it's not in use for a certain period of time - and it auto-starts again when a request for your app comes in.)

Joyent's SmartOS platform is a Linux OS optimized for hosting your node.js app. They have impressive reliability and performance as well as great diagnostic tools.

http://wiki.joyent.com/wiki/display/jpc2/Developing+a+Node.js+Application

The most cost effective solution I have found so far is DigitalOcean, a great new hosting solution where you can host a full Linux VM for only $5/month! I have had great luck hosting Node apps there so far: https://www.digitalocean.com/pricing

Amatol answered 10/7, 2013 at 12:37 Comment(0)
G
5

a2hosting allows Node.js in shared hosting.But don't have experience there.Found from a web search

Update : Use DigitalOcean. Private VPS

Gatto answered 4/5, 2014 at 3:34 Comment(3)
Very positive experience. See their instructions to install node by using Apache as a reverse proxy: a2hosting.com/kb/installable-applications/manual-installations/…Galangal
In theory they do but you can't drop to root in shared hosting on A2 which in my case was required to install so I gave up on a2.Parade
No. A2 Hosting works with node.js without root access. Net result: you can get node.js working even on their ~$4 a month shared hosting accounts. See the link above to their knowledgebase article. BTW, the method they describe might work on other hosting accounts as well.Galangal
P
4

Node doesn't work like most servers. With IIS and Apache, there is one server running multiple sites, which lends itself to shared environments. With Node, you're running your own server so instead you tend to share resources on a machine.

I can't tell you whether it's worth learning node because I don't know your motivation, but it can expand your career opportunities if you choose to go there, and to expand your skillset.

Here are a couple of hosting options in the low price range.

http://nodester.com/

https://www.nodejitsu.com/

Packard answered 8/7, 2013 at 14:58 Comment(3)
Node does work with IIS -> hanselman.com/blog/…Idyllic
As of March 2015, nodester does not resolve, nodejitsu has been folded into GoDaddy and no longer offers node PaaSLay
I use nodejs because I don't have to learn a new language I already know it.Behring

© 2022 - 2024 — McMap. All rights reserved.