如何在同一IP/服务器上的不同域中托管多个Node.js站点? [英] How do I host multiple Node.js sites on the same IP/server with different domains?

查看:79
本文介绍了如何在同一IP/服务器上的不同域中托管多个Node.js站点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绑定了单个IP的Linux服务器.我想在此IP上的此服务器上托管多个Node.js站点,每个站点(显然)都具有唯一的域或子域.我希望它们都在端口80上.

I have a linux server with a single IP bound to it. I want to host multiple Node.js sites on this server on this IP, each (obviously) with a unique domain or subdomain. I want them all on port 80.

我有什么选择呢?

一个显而易见的解决方案似乎是让所有域都由一个node.js Web应用程序提供服务,该Web应用程序充当代理并传递到在唯一端口上运行的其他node.js应用程序.

An obvious solution seems to be to have all domains serviced by a node.js web app that acts as a proxy and does a pass through to the other node.js apps running on unique ports.

推荐答案

选择以下一项:

  • Use some other server (like nginx) as a reverse proxy.
  • Use node-http-proxy as a reverse proxy.
  • Use the vhost middleware if each domain can be served from the same Connect/Express codebase and node.js instance.

这篇关于如何在同一IP/服务器上的不同域中托管多个Node.js站点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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