为什么node.js无法在共享主机上运行? [英] Why node.js can't run on shared hosting?

查看:91
本文介绍了为什么node.js无法在共享主机上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一件事::我在所有知名的网络托管公司中搜索了nodejs的共享托管,但没有找到任何人.然后我知道nodejs无法在共享主机系统上运行.我想知道为什么吗?

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?

第二件事:我是一个预算正常的普通人.选择vps或专用服务器或云托管可使节点运行,但是与PHP共享托管服务相比,它超出了我的承受能力,所以我应该学习node.js吗?

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?

推荐答案

从理论上讲可以,但是实际上,要依靠托管服务提供商来提供这样的基础结构.

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

与传统Web平台相比,Node是可自我维持的平台.如果使用PHP(例如),则可以使用apache或nginx(或其他任何语言)运行,而PHP本身只是具有某些库的脚本语言,这些库在逻辑实现上没有多大区别,并且需要Web服务器解决方案. Web服务器创建套接字以侦听特定端口的通信,将发挥自己的魔力并执行PHP来处理请求.

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.

同时,node.js创建自己的套接字,并将其绑定到自己的端口.这给它提供了更多的低级访问权限,因此它本身就是Web服务器.您不能将两个应用程序绑定到一个端口,因此它已经不可共享.
有一些服务(Web服务器)使您可以创建代理以将流量路由到node.js进程,但是在某些情况下效率不高,并且共享托管不提供此类功能.

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.

由于node.js仍然还很年轻,与众不同,它仍然没有影响大多数共享托管服务.在线上有一些可用服务以共享"方式托管您的node.js应用程序.

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.

此外,您可以在AWS(免费套餐)上免费租用EC2 Micro实例一年(免费),这为您提供了很多机会和时间来尝试测试不同的东西.您将获得半专用系统,在该系统中您可以执行几乎所有操作(安装软件,修改OS配置等等),而共享主机则不允许这样做.

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.

这篇关于为什么node.js无法在共享主机上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆