【问题标题】:In IIS 8.5, how do I map a sub-domain to an application within a site?在 IIS 8.5 中,如何将子域映射到站点内的应用程序?
【发布时间】:2017-04-18 19:34:36
【问题描述】:

目前我有一个 IIS 8.5 服务器,其 URL 为:

subdomain.domain.com/application_instance_name_1

在一个名为 Portal Application 的站点下,有 3 个应用程序实例,每个客户一个。

我想为每个客户创建一个子域并将其定向到名为 Portal Application 的站点下的应用程序版本,例如,客户 1 将输入:

customer_1_name.domain.com

在 IIS 中,它将被定向到以下站点和应用程序:

站点/门户应用程序/customer_1_application

这是我第一次在这里发帖,我确实找到了一些可能与 here 相关的东西,但它适用于 Apache 而不是 IIS。

如果您需要更多信息,请告诉我。

谢谢

布莱恩

【问题讨论】:

    标签: redirect iis subdomain


    【解决方案1】:

    1) 您需要为 IIS 安装 URL RewriteARR module

    2) 启用 ARR。在Application Request Routing 页面上,选择Enable proxy

    3) 创建重写规则

        <rewrite>
            <rules>
               <rule name="rewrite customer_1_name.domain.com" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_HOST}" pattern="^customer_1_name.domain.com$" ignoreCase="true" />
                    </conditions>
                    <action type="Rewrite" url="http://subdomain.domain.com/Portal Application/customer_1_application/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    

    附:您的资源(图像、样式、css、js)可能有问题。因为您的 html 可能包含资源的绝对路径

    当作者创建出站规则以修复相对网址https://blogs.iis.net/carlosag/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr时,您可以查看此帖子

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-17
      • 2011-12-29
      • 2019-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多