简体   繁体   English

如何在单个nginx安装中配置多个域以使用同一应用程序实例?

[英]How to configure multiple domains, within a single nginx installation to use the same instance of an application?

I want to a specific folder on multiple domains, under the same nginx installation to use the same instance of a nodejs application. 我想在同一nginx安装下的多个域上的特定文件夹中使用nodejs应用程序的相同实例。

I have the domains "domain1.com", "domain2.com" and "domain3.com", each with their own static files (only). 我有域“ domain1.com”,“ domain2.com”和“ domain3.com”,每个域都有自己的静态文件(仅)。 What I want is that " http://domain1.com/feature " is handled by nodejs and " http://domain2.com/feature " is handled by the same app (memory and stuff) that handles " http://domain1.com/feature ". 我想要的是“ http://domain1.com/feature ”由nodejs处理,而“ http://domain2.com/feature ”由处理“ http:// ”的同一应用(内存和内容)处理domain1.com/feature “。

I don't mind creating another domain/subdomain to handle that, but I do not want to create any redirections (the user that uses domain1 should not be aware that domain2 exists and so on). 我不介意创建另一个域/子域来处理该问题,但是我不想创建任何重定向(使用domain1的用户不应知道domain2存在,依此类推)。

Can this be accomplished? 能做到吗?

Thanks in advance. 提前致谢。

取决于应用程序的体系结构,但您可能希望使用nginx的重写模块来代理它,重写URL以使用相同的位置,但共享相同的后端URL。

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

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