使用自定义域和 SSL 在 2 个 Web 应用上配置 Azure 流量管理器

Configure Azure Traffic Manager over 2 web apps with custom domain and SSL

背景

我有两个网站:
- web1.azurewebsites.net
- web2.azurewebsites.net

我添加了一个名为 webtm.trafficmanager.net 的流量管理器。

web1.azurewebsites.net 配置了自定义域 web.example.com。我还向其中添加了通配符 SSL 证书(即 *.example.com)。如果我请求 web.example.com 它可以毫无问题地为网站提供服务。

要求

我需要在这两个站点上设置流量管理器。所以,如果 web1.azurewebsites.net 是 down/offline,那么流量管理器可以自动切换到 web2.azurewebsites.net。

实施问题

我已经阅读了这些 SO 答案(SO 1, ) and this docs article,但是,我有一些疑问。如果有人能证实我在下面概述的理解,我将不胜感激?

第 1 步: 我知道我必须将 DNS 记录更新为:web.example.com. 60 IN CNAME webtm.trafficmanager.net.。删除指向 web.example.com to web1.azurewebsites.net 的其他 DNS/CNAME 条记录。

第 2 步: 我需要从 web1.azurewebsites.net 中删除当前的自定义域映射,然后重新添加它。将自定义域设置为 web.example.com,CNAME 配置将显示流量管理器端点。此步骤不需要更改 DNS?

步骤 3: 将自定义域添加到 web2.azurewebsites.net 将自定义域设置为 web.example.com,CNAME 配置将显示流量管理器端点。此步骤不需要更改 DNS?

第 4 步: 没有更改添加到 web1.azurewebsites.net 的 SSL 证书。

第 5 步: 将 SSL 证书添加到 web2.azurewebsites.net。

现在,访问 https://web.example.com 应该会影响流量管理器。它会看到 web1.azurewebsites.net 在线,因此它会将用户引导至此。如果 web1.azurewebsites.net 出现故障,它会自动将用户重定向到 web2.azurewebsites.net。

谢谢!

你的步骤基本正确。你要做的就是按照这个文件---Configure a custom domain name in Azure App Service with Traffic Manager integration

在第3步和第4步中,流量管理器域名将显示在CNAME配置下。 Select 它并单击 添加自定义域 。不需要其他步骤。

If a record is already in use and you need to preemptively bind your apps to it, you can create an additional CNAME record. For example, to preemptively bind www.contoso.com to your app, create a CNAME record from awverify.www to contoso.trafficmanager.net. You can then add www.contoso.com to your app without the need to change the www CNAME record. For more information, see Migrate an active DNS name to Azure App Service.

您还可以在 this blog 中看到完整的步骤。在此博客中,它在不同的订阅中使用了第二个 Web 应用程序,因此它为此选择了一个外部端点。如果您的第一个 Web 应用和流量管理器实例在同一个订阅中,请像往常一样使用 Azure 端点,然后选择该订阅中的 Web 应用。

如果您遇到任何问题,请告诉我。