简体   繁体   English

IIS 反向代理 - 2 个子域到 2 个 Node.js

[英]IIS reverse proxy - 2 subdomain to 2 Node.js

As in this blog is well explained how to point a domain or subdomain in IIS to a Node.js project.正如在这篇博客中很好地解释了如何将 IIS 中的域或子域指向 Node.js 项目。 In this case its needed to have two subdomains each point to a Node.js project (localhost:port) in the example works well for one project but not for two.在这种情况下,它需要有两个子域,每个子域都指向一个 Node.js 项目(localhost:port),该示例适用于一个项目,但不适用于两个项目。

So in this case its needed for subdomain1 point to localhost:80 and subdomain2 point to localhost:82 for example.因此,在这种情况下,它需要 subdomain1 指向 localhost:80 和 subdomain2 指向 localhost:82 例如。

In the reverse proxy have:在反向代理中有: 在此处输入图像描述

in the pattern had (.*) but that would match any and my subdomains would point to same Node.js project.在模式中有 (.*) 但这将匹配任何并且我的子域将指向相同的 Node.js 项目。 So tried to make the reverse proxy pattern match its subdomain as in here and in the printscrean and also tried as in this post in iis forum as @PascalN answer:因此,尝试使反向代理模式与此处和打印屏幕中的子域匹配,并尝试在 iis 论坛中的这篇文章中作为@PascalN 回答:

RequestedURL: Matches the pattern

Using: Wildcard

Pattern: http://www.iisserver.mycompany.com/internal1/*

In the Action section you should have something like this

Action Type: Rewrite

Rewrite URL: http://internal1.mycompany.com/{R:0}

And finally you can add another rule for your internal2 server

but still not working and doesn't even redirects/point to that port internaly.但仍然无法正常工作,甚至没有在内部重定向/指向该端口。

My mistake in the configuration of both sites the phisical path was the same (same folder) what originated that the sites shared the two reverse proxys.我在两个站点的配置中的错误是物理路径是相同的(相同的文件夹),这源于站点共享两个反向代理。

Assumed that with the use of reverse proxy would point to another project (Node.js) would't have any conflict sharing the same phisical folder but that was in fact my probleam, now each site points to different folders, so each site only haves one reverse proxy as expected and works.假设使用反向代理将指向另一个项目(Node.js)共享相同的物理文件夹不会有任何冲突,但这实际上是我的问题,现在每个站点都指向不同的文件夹,所以每个站点只有一个按预期工作的反向代理。

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

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