《Windows Azure Platform 系列文章目录

  在之前的文章中,笔者介绍了Azure Web App可以设置URL路由。如下图:

  

  在这里笔者简单介绍一下,首先我们还是创建以下资源:

  1.创建一个新的Azure Resource Group,命名为LeiAppGWRG

  2.创建一个新的ARM Virtual Network,命名为LeiAppGatewayVNet

      有两个Subnet,分别为web-subnet,CIDR: 10.0.0.0/24

      另外一个subnet,叫appgateway-subnet,专门给Application Gateway使用,CIDR:10.0.1.0/24

  3.在创建新的Application Gateway,命名为:LeiAppGateway

  需要注意:如果我们要针对80端口设置URL Routing,我们必须设置Listener Configuration为Port 81

  不可以是Port 80,因为会被占用需要修改

  不可以是Port 80,因为会被占用需要修改

  不可以是Port 80,因为会被占用需要修改

  

  然后等Azure Application Gateway创建完毕  

  在这里还需要强调一下,当我们接下来还要操作的步骤:

  1.针对80端口,增加Listener

  2.不要修改和使用默认的appGatewayBackendPool

  3.在Backend Pools,创建新的imagesBackendPool,并设置Backend Addresses

  4.在Backend Pools,创建新的videosBackendPool,并设置Backend Addresses

  5.最后配置一下Application Gateway的Rules

  1.接下来开始第一部分,针对80端口,增加Listener

  我们选择Application Gateway,选择Listener,然后点击 + Basic。

  新增加针对80端口的Listerner: appGateway80Listener。如下图:

  

  2.不要修改和使用默认的appGatewayBackendPool

  3.选择Application Gateway,选择Backend Pool,然后点击Add。增加新的imagesBackendPool,并设置Backend Addresses

  当我们访问这个imagesBackendPool的时候,Application Gateway会把请求发送到内网IP为10.0.0.4和10.0.0.5的这2台VM

  

    

  4.选择Application Gateway,选择Backend Pool,然后点击Add。增加videosBackendPool,Address设置为10.0.0.11和10.0.0.12

  这样我们访问url路径为/images的时候,Application Gateway会把请求发送到内网IP为10.0.0.11和10.0.0.12的这2台VM

  

  5.最后,我们设置Rules,点击+ Path-based,命名为pathBasedRule。

  Listener选择之前创建的appGateway80Listener

  Default backend pool为appGatewayBackendPool

  注意下图的BackEndPool,选择默认的appGatewayBackendPool和我们新创建的imagessBackendPool。 

  需要注意,当我们访问Application Gateway的地址时候,访问逻辑是这样的:

  (1)如果我们访问URL路径为/images/*的时候,请求被发送到imagesBackendPool,对应的内网IP地址为10.0.0.4和10.0.0.5

  (2)如果我们访问URL路径为/videos/*的时候,请求被发送到videosBackendPool,对应的内网IP地址为10.0.0.11和10.0.0.12

  (3)当Path不匹配的时候,请求被发送到默认的imagesBackendPool。

  

  截图如下:

  

  

  6.准备Backend Pool所需要的虚拟机。

  然后我们在先创建新的Azure ARM Storage Account,然后创建4台Windows Server 2012 R2的虚拟机,对应的IP如下:

虚拟机名称 内网IP地址 Virtual Network子网 对应Application Gateway的Backend Pool 对应Application Gateway的访问URL路径 备注
ImagesVM01 10.0.0.4 web-subnet appGatewayBackendPool /images/* 安装IIS,增加虚拟目录images。修改IIS欢迎页面为虚拟机机器名
ImagesVM02 10.0.0.5 web-subnet appGatewayBackendPool /images/* 安装IIS,增加虚拟目录images。修改IIS欢迎页面为虚拟机机器名
VideosVM01 10.0.0.11 web-subnet videosBackendPool /videos/* 安装IIS,增加虚拟目录videos。修改IIS欢迎页面为虚拟机机器名
VideosVM02 10.0.0.12 web-subnet videosBackendPool /videos/* 安装IIS,增加虚拟目录videos。修改IIS欢迎页面为虚拟机机器名

  

  创建完毕后,请记住,因为我们针对Port 80设置Application Gateway,需要在上面的VM上安装IIS,并增加相应的虚拟目录。

  

  7.然后我们查看Azure Application Gateway,点击Overview,就可以查看到这个Application Gateway的动态IP(注意是动态IP地址,不是静态IP)和DNS Name。

  如下图:

  

  动态IP是: 139.219.234.106

  DNS是:ceca34df-a6ed-4914-8137-f44223e220e6.chinacloudapp.cn

  8.我们访问上面的Frontend Public IP Address,比如:

  http://139.219.234.106/images

  这个请求就会被发送到appGatewayBackendPool的两台VM,内网IP分为别10.0.0.4和10.0.0.5

  

  我们访问:http://139.219.234.106/videos/

  这个这个请求就会被发送到videosBackendPool的两台VM,内网IP分为别10.0.0.11和10.0.0.12

  

  

Azure Application Gateway (3) 设置URL路由的更多相关文章

  1. Azure Application Gateway (4) 设置URL路由 - PowerShell

    <Windows Azure Platform 系列文章目录> 本文将介绍如果使用Azure PowerShell,创建Azure Application Gateway URL Rout ...

  2. Azure Application Gateway (1) 入门

    <Windows Azure Platform 系列文章目录> 请读者注意,Azure Application Gateway在ASM模式下,只能通过PowerShell创建 具体可以参考 ...

  3. Azure Application Gateway(一)对后端 Web App 进行负载均衡

    一,引言 今天,我们学习一个新的知识点-----Azure Application Gateway,通过Azure 应用程序网关为我么后端的服务提供负载均衡的功能.我们再文章头中大概先了解一下什么是应 ...

  4. Azure Application Gateway(二)对后端 VM 进行负载均衡

    一,引言 上一节有讲到使用 Azure Application Gateway 为我们后端类型为 Web App 的 Demo 项目提供负载均衡,Azure Application Gateway 的 ...

  5. Azure Application Gateway (5) Application Gateway SSL Offload配置

    <Windows Azure Platform 系列文章目录> 之前有个客户提出了一个需求,他们的互联网访问的架构分为两种: 1.第一层是使用Azure Application Gatew ...

  6. Azure Application Gateway (2) 面向公网的Application Gateway

    <Windows Azure Platform 系列文章目录> 本章将介绍如何创建面向公网的Application Gateway,我们需要准备以下工作: 1.创建新的Azure Reso ...

  7. Windows Azure支持七层负载均衡--Application Gateway

    一直以来Windows Azure的负载均衡(Loadbalancer)功能一直被客户诟病,无法其竞争对手(特别是国内的云厂商)匹敌. Windows Azure的负载均衡器是四层的,前期的版本不支持 ...

  8. 【Azure 事件中心】为应用程序网关(Application Gateway with WAF) 配置诊断日志,发送到事件中心

    问题描述 在Application Gateway中,开启WAF(Web application firewall)后,现在需要把访问的日志输出到第三方分析代码中进行分析,如何来获取WAF的诊断日志呢 ...

  9. Ionic 动态配置url路由的设置

    随着Ionic App功能的不断增加,需要路由的url设置就越来越多,不喜欢在config函数中写一堆硬代码,一则不美,二则维护起来也麻烦,能不能把这些数据独立出来呢? 经过查找资料与各种实验,最终找 ...

随机推荐

  1. 防止XSS攻击的方法

    什么是XSS? 使用Jsoup来防止XSS攻击 Jsoup官网 Jsoup中文 maven包引入 <dependency> <groupId>org.jsoup</gro ...

  2. linux ping加执行时间

    [root@back_zabbix_100 ~]# ping 10.10.30.250 | awk '{print $0"\t" strftime("%H:%M:%S&q ...

  3. 设置DataGridView的某个单元格为ComboBox

    怎么将DataGridView的 某个单元格设为ComboBox的样式而不是整列都改变样式? 1.最简单的方法:利用DataGridView提供的DataGridViewComboBoxCell. 写 ...

  4. IOS第一天-新浪微博 - 框架的搭建

    *************HWAppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWith ...

  5. Event Store 2.0发布,带来了安全支持和测试版Projections库

    Event Store 2.0版本于上周发布,它带来了安全支持允许锁定Event Store和在事件流上设置访问控制列表.其主要新特性包括: HTTP和TCP之上的身份认证,包括账户管理 测试版Pro ...

  6. 玩转Asp.net MVC 的八个扩展点

    MVC模型以低耦合.可重用.可维护性高等众多优点已逐渐代替了WebForm模型.能够灵活使用MVC提供的扩展点可以达到事半功倍的效果,另一方面Asp.net MVC优秀的设计和高质量的代码也值得我们去 ...

  7. 开始用Word 2013来写博客

    第一步:如果从未发布过博客文章的话,需要在菜单里面选这里添加博客账号   第二步:选择正确的设置   第三步:写完博客之后,按这里就可以发布了!   如果以后需要写新的博客的话,还可以直接点这里:   ...

  8. SQL Azure (18) 使用External Table实现垮库查询

    <Windows Azure Platform 系列文章目录> 问题 1.我们在进行SQL Server开发的时候,经常会使用垮库查询.但是在默认情况下,使用Azure SQL Datab ...

  9. 每天一个linux命令(48):watch命令

    watch是一个非常实用的命令,基本所有的Linux发行版都带有这个小工具,如同名字一样,watch可以帮你监测一个命令的运行结果,省得你一遍遍的手动运行.在Linux下,watch是周期性的执行下个 ...

  10. iOS------苹果设备处理器指令集(iPhone初代到iPhone5s)

    (via 雅香小筑) Arm处理器,因为其低功耗和小尺寸而闻名,几乎所有的手机处理器都基于arm,其在嵌入式系统中的应用非常广泛,它的性能在同等功耗产品中也很出色. Armv6.armv7.armv7 ...