简体   繁体   English

IIS7:将请求重定向到内部端口

[英]IIS7: Redirect request to internal port

I have a NodeJS application. 我有一个NodeJS应用程序。 I want to create a different instance of this application for each of my clients. 我想为每个客户创建此应用程序的不同实例。 My initial thoughts were to have each instance in a different port, and then launch a Node instance listening to those ports: 我最初的想法是将每个实例放在不同的端口中,然后启动一个侦听这些端口的Node实例:

Client 1: http://client1.myapp:81 (an instance of my Node app listening port 81) 客户端1: http://client1.myapp:81 (我的Node应用程序侦听端口81的实例)

Client 2: http://client2.myapp:82 (an instance of my Node app listening port 82) 客户端2: http://client2.myapp:82 (我的Node应用程序侦听端口82的实例)

... ...

I wouldn't want to open so many ports externally, so I'd like to know if it's possible to have my clients accessing their apps through port 80: 我不想在外部打开这么多端口,所以我想知道是否有可能让我的客户通过端口80访问其应用程序:

Client 1: http://client1.myapp 客户端1: http://client1.myapp

Client 2: http://client2.myapp 客户端2: http://client2.myapp

... ...

and then have IIS redirect each request to its corresponding INTERNAL port, where the specific NodeJS app instance would be listening. 然后让IIS将每个请求重定向到其对应的INTERNAL端口,特定的NodeJS应用程序实例将在其中侦听。

This way I only need port 80 opened externally. 这样,我只需要在外部打开端口80。

Is this possible? 这可能吗? Is this common practice? 这是惯例吗?

Thanks in advance. 提前致谢。

You can do what you suggested in your second example (sub domains). 您可以按照第二个示例(子域)中的建议进行操作。 What you will need is a valid domain and a static IP address. 您将需要一个有效的域和一个静态IP地址。 You will need to add an A record (to your DNS server) to redirect all your sub domains to your IP (ie *.your_domain.com --> your IP address) 您将需要添加A记录(到您的DNS服务器),以将所有子域重定向到您的IP(即* .your_domain.com->您的IP地址)

Then for each of your clients you will have to create a site with his header - clientX.your_domain.com 然后,对于每个客户,您都必须创建一个带有标题的网站-clientX.your_domain.com

This is common practice. 这是惯例。 I also use this method to show my clients their websites. 我也使用这种方法向客户显示他们的网站。

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

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