简体   繁体   English

在同一服务器/域名上托管多个nodejs

[英]Hosting multiple nodejs on same server/domain name

I'm intending to host an online portfolio and I have several node.js projects I'd like to host. 我打算托管一个在线投资组合,并且我有几个我想托管的node.js项目。

So I'd like to host one project on domain.net/project1 and the other on domain.net/project2 所以我想将一个项目托管在domain.net/project1上,将另一个托管在domain.net/project2上

Do I need to use a single nodejs process to do this, or is it possible to have each of my separate nodejs projects running independently? 我是否需要使用单个nodejs进程来执行此操作,还是可以让我的每个单独的nodejs项目独立运行?

Is it possible to assign a nodejs process to each subdomain? 是否可以为每个子域分配一个nodejs进程?

A better approach will be to host your NodeJS projects independently and then use the domain(hosted and provided by platform) to Custom Sub-Domain(created by you) pointing to point each of your projects to custom subdomains like project1.mydomain.com. 更好的方法是独立托管您的NodeJS项目,然后将域(由平台托管和提供)用于“自定义子域”(由您创建),以指向您的每个项目指向自定义子域,例如project1.mydomain.com。 This will provide you the flexibility to deploy your node applications on Heroku, AWS or any other hosting environment. 这将为您提供在Heroku,AWS或任何其他托管环境上部署节点应用程序的灵活性。

Thus you get freedom of choosing your own hosting platform and can have as many projects hosted as needed. 因此,您可以自由选择自己的托管平台,并且可以根据需要托管任意数量的项目。 I have attached an architecture diagram for the same and the link to the original draw.io document. 我已经附上了相同的架构图,并附有原始的draw.io文档的链接。 Also please note that this is just a sample, and your design may vary as per your specific requirements 另外请注意,这只是一个示例,您的设计可能会根据您的特定要求而有所不同

在此处输入图片说明

You can refer this Arc diagram for more details. 您可以参考此弧形图以获取更多详细信息。

You can use nginx or apache http for host each project or create a path that contains sub paths for each one. 您可以使用nginx或apache http托管每个项目,也可以创建一个包含每个子路径的路径。

Here come references: 这里有参考资料:

Apache http 阿帕奇http

nginx hosting Nginx托管

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM