如何设置我的Linode服务器在不同子域上运行多个程序?

我刚刚得到一个linode帐户和一些域名。 有了这些原材料,我想要做的是:

example.com -- static hosting gitlab.example.com -- install gitlab here dev.example.com -- be able to install ruby stuff here another-domain.com -- run a node server from here third-domain.com -- run another node server from here 

我只有Apache的经验,但我不知道如何将Apache与Node集成。 但是真的,我想知道做这个最好的方法是什么?

不要担心我是否知道这项技术 – 我会学习的!

使用某种反向代理作为所有这些服务的“前端”。 如果你熟悉Apache,那么使用mod_proxy。 如果你愿意学习nginx,那么这可能是一个更好的select,因为它更轻量级。

将您的所有子域指向您的nginx实例,并configuration您的各个守护进程以侦听不同的端口。 然后在nginx中configuration虚拟主机来代理请求到本地主机上的相应端口。

例如,让我们考虑another-domain.com的节点实例。 让节点实例在localhost:10888localhost:10888 。 将another-domain.com指向您的linode的IP地址,并在nginx中configuration一个虚拟主机,以将another-domain.com localhost:10888请求代理到localhost:10888