---
title: "用IIS配置反向代理"
author: "lanfei"
date: "2014-07-11T11:15:50Z"
tags: []
categories: ["互联网"]
slug: "iis"
draft: false
lastmod: "2014-07-11T11:16:26Z"
id: 2090723
url: "https://lanfei.iteye.com/blog/2090723"
---

http://blog.csdn.net/g2321514568/article/details/12406755

 

目标服务器：targetServer

配置反向代理的服务器：reveseProxServer

1、确定最终访问的网址：比如www.baidu.com  、www.csdn.net等等。

    当然你也可以自己在targetServer部署自己的程序，在此为了示范，我在targetServer上部署了2个，用的8088端口，程序分别是：

    http://targetServer:8088/Auditsys/Default.htm

    http://targetServer:8088/GCustomer/Login.htm

    如图：

         [![](http://static.oschina.net/uploads/space/2013/0419/092734_0jxL_261110.png)](http://static.oschina.net/uploads/space/2013/0419/092734_0jxL_261110.png)

2、下面的操作均在在reveseProxServer上执行。

3、安装IIS。

4、安装ARR，下载地址([http://www.iis.net/downloads/microsoft/application-request-routing](http://www.iis.net/downloads/microsoft/application-request-routing))

5、新建一个网站:(我的示例YIWeb，端口是8080)   http://reveseProxServer:8080

    [![](http://static.oschina.net/uploads/space/2013/0419/101554_p3Jq_261110.png)](http://static.oschina.net/uploads/space/2013/0419/101554_p3Jq_261110.png)

5、启用Proxy

[![](http://static.oschina.net/uploads/space/2013/0419/093454_qnue_261110.png)](http://static.oschina.net/uploads/space/2013/0419/093454_qnue_261110.png)

 

[![](http://static.oschina.net/uploads/space/2013/0419/094734_8MuQ_261110.png)](http://static.oschina.net/uploads/space/2013/0419/094734_8MuQ_261110.png)    

[![](http://static.oschina.net/uploads/space/2013/0419/094824_b97m_261110.png)](http://static.oschina.net/uploads/space/2013/0419/094824_b97m_261110.png)

6、添加URL重写规则

   [![](http://static.oschina.net/uploads/space/2013/0419/101823_nzM1_261110.png)](http://static.oschina.net/uploads/space/2013/0419/101823_nzM1_261110.png)

 

然后添加一个空白规则：

[![](http://static.oschina.net/uploads/space/2013/0419/102745_pASf_261110.png)](http://static.oschina.net/uploads/space/2013/0419/102745_pASf_261110.png)

[![](http://static.oschina.net/uploads/space/2013/0419/102644_eZjZ_261110.png)](http://static.oschina.net/uploads/space/2013/0419/102644_eZjZ_261110.png)

[![](http://static.oschina.net/uploads/space/2013/0419/102833_rLOX_261110.png)](http://static.oschina.net/uploads/space/2013/0419/102833_rLOX_261110.png)

保存这个规则，ok了！

7、试试效果

[![](http://static.oschina.net/uploads/space/2013/0419/103122_spvt_261110.png)](http://static.oschina.net/uploads/space/2013/0419/103122_spvt_261110.png)

[![](http://static.oschina.net/uploads/space/2013/0419/103242_DSEL_261110.png)](http://static.oschina.net/uploads/space/2013/0419/103242_DSEL_261110.png)

 

8、总结：

    上面的 ^(.\*) 、 ^192.168.3.73:8080$ 、http://targetserver:8088/{R:1}

    表示：用192.168.3.73:8080替换http://targetserver:8088/，

            {R:1}就表示^(.\*)，意思是“http://targetserver:8088/”后面匹配任何字符

            eg:访问192.168.3.73:8080/test/index.htm

                这个url就被重写成了http://targetserver:8088/test/index.htm