是否可以将 IIS 配置为将流量路由到另一台服务器



我在website.com有一个Windows服务器,我有另一个带有WordPress的服务器。

如何配置 IIS 以将website.com/blog路由到我的 WordPress?

我尝试使用虚拟目录,但我只能将我的用户发送到同一台服务器。

根据您的描述,我建议您考虑使用 ARR 反向代理来实现您的要求。

我建议您使用此链接和此链接安装 ARR。

然后我建议你可以尝试使用以下网址重写规则。

            <rule name="ReverseProxyInboundRule2" stopProcessing="true">
                <match url="/blog/(.*)" />
                <action type="Rewrite" url="http://ec2 ubuntu address/{R:1}" />
            </rule>

谢谢,它有效,但我不得不向我的 web.config 添加更多代码。

我的网络配置:

<rewrite> 
            <rules> 
<clear />
                <rule name="Route the requests for Company1" enabled="true" patternSyntax="ECMAScript" stopProcessing="false"> 
                    <match url="(.*)" /> 
                    <conditions>
                        <add input="{CACHE_URL}" pattern="^(https?)://" /> 
                    </conditions> 
                    <action type="Rewrite" url="https://blog.raczum.com/{R:0}" /> 
                    <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="" /> 
                    </serverVariables> 
                </rule> 
        <rule name="Route the subfolder blog" enabled="false" patternSyntax="Wildcard" stopProcessing="false"> 
                    <match url="https://raczum.com/blog/*" /> 
                    <conditions>
                        <add input="{CACHE_URL}" pattern="^(https?)://" /> 
                    </conditions> 
                    <action type="Rewrite" url="https://blog.raczum.com/{R:1}" /> 
                    <serverVariables>
                        <set name="HTTP_ACCEPT_ENCODING" value="" /> 
                    </serverVariables> 
                </rule>             </rules> 
            <outboundRules> 
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="true" stopProcessing="false"> 
                    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://blog.raczum.com/(.*)" /> 
                    <action type="Rewrite" value="/blog/{R:2}" />
                    <conditions logicalGrouping="MatchAny" trackAllCaptures="false" /> 
                </rule> 
                <rule name="RewriteRelativePaths" preCondition="ResponseIsHtml1" enabled="true" stopProcessing="false"> 
                    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^http(s)?://blog.raczum.com/(.*)$" negate="false" /> 
                    <action type="Rewrite" value="/blog/{R:2}" /> 
                </rule> 
                <preConditions> 
                    <preCondition name="ResponseIsHtml1" patternSyntax="Wildcard">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="*" /> 
                    </preCondition>
                    <preCondition name="ResponseIsHtml2">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition> 
                </preConditions> 
            </outboundRules> 
        </rewrite>

相关内容

最新更新