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?

Yousuf Memon
  • 4,638
  • 12
  • 41
  • 57

6 Answers6

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.

moka
  • 22,846
  • 4
  • 51
  • 67
  • 14
    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](https://engineering.gosquared.com/optimising-nginx-node-js-and-networking-for-heavy-workloads). 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. – slang Dec 30 '13 at 00:00
  • 7
    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. – moka Jan 02 '14 at 13:21
  • 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. – slang Jan 03 '14 at 14:35
  • 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. – moka Jan 03 '14 at 17:03
  • In fact answer Did mentioned about proxying. And now I've corrected it to reflect more recent situation. – moka Jan 03 '14 at 17:06
  • 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. – JD-V Aug 28 '17 at 06:11
12

There are other ways to deploy node.js apps.

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

Community
  • 1
  • 1
jh314
  • 27,144
  • 16
  • 62
  • 82
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...

Ed.
  • 344
  • 1
  • 5
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

Svbaker
  • 706
  • 3
  • 4
5

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

Update : Use DigitalOcean. Private VPS

user2473015
  • 1,392
  • 3
  • 22
  • 47
  • 2
    Very positive experience. See their instructions to install node by using Apache as a reverse proxy: https://www.a2hosting.com/kb/installable-applications/manual-installations/installing-node-js-on-managed-hosting-accounts – aap Sep 12 '15 at 05:42
  • 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. – Elliot Robert Jan 31 '16 at 19:28
  • 1
    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. – aap Dec 08 '16 at 18:18
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/

Thinking Sites
  • 3,494
  • 17
  • 30
  • Node does work with IIS -> http://www.hanselman.com/blog/InstallingAndRunningNodejsApplicationsWithinIISOnWindowsAreYouMad.aspx – Idrees Khan Aug 25 '14 at 05:34
  • 7
    As of March 2015, nodester does not resolve, nodejitsu has been folded into GoDaddy and no longer offers node PaaS – SW4 Mar 24 '15 at 10:02
  • I use nodejs because I don't have to learn a new language I already know it. – zachdyer Jun 05 '15 at 15:00