IIS实现反向代理
新建两个站点,端口分别使用 80 和 81,在DNS中新建A记录,指向该计算机(10.4.34.41)
配置过程如下:
1.在Windows Server 2012 R2上 安装ARR,URL Rewriter组件。
ARR3.0需要如下组件支持:Web Farm Framework 2.2(该组件又需要Web Platform Installer 3.0 和 WebDeploy 2.0组件的支持)
URL Rewriter2.0(For IIS7.0,支持Win 2012 R2)直接安装即可。
下载地址:http://www.iis.net/downloads/microsoft/application-request-routing
http://www.iis.net/downloads/microsoft/web-farm-framework




配置完成后如下图:
在外部访问 la80.ddv.com 和la81.ddv.com可以访问成功。
通过配置web.config文件,也可以实现 URL重写,如下:
<rewrite>
<rules>
<rule name="phpweb">
<match url="^(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^phpweb.leven.com.cn$" />
</conditions>
<action type="Rewrite" url="http://localhost:8081/{R:1}" />
</rule>
</rules>
</rewrite>
参考来源:http://blog.sina.com.cn/s/blog_532f78a40100rlpn.html
ARR安装完成后,如果在IIS里面看不到ARR图标,解决方法如下:
1.分别通过如下命令打开 IIS管理器,查看有无ARR图标:
%windir%\System32\inetsrv\iis.msc
%windir%\system32\inetsrv\InetMgr.exe
2.通过PS脚本检查ARR是否安装成功:
$dll=[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
#Get the manager and config object
$mgr = new-object Microsoft.Web.Administration.ServerManager
$conf = $mgr.GetApplicationHostConfiguration()
#Get the webFarms section
$section = $conf.GetSection("webFarms")
$section
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步