2

我在 Azure 的同一台机器上的不同端口上托管了多个站点:

foobar.com:8000
foobar.com:8001
foobar.com:8002 

ETC

我想使用反向代理通过子域解决这些问题;

aaaa.mysite.com ----> foobar.com:8000
bbbb.mysite.com ----> foobar.com:8001
cccc.mysite.com ----> foobar.com:8002

是否可以在应用程序网关中执行此操作?它似乎只迎合不同的路径(而不是子域),并且不允许为后端指定端口。

是否还有其他 Azure 功能允许这样做(例如 Front Door)?

4

1 回答 1

2

As your requirement to address them by subdomains in APP GW, you could use multi-site hosting.

There are three common mechanisms for enabling multiple site hosting on the same infrastructure.

Host multiple web applications each on a unique IP address. Use host name to host multiple web applications on the same IP address. Use different ports to host multiple web applications on the same IP address.

For example, you want aaaa.mysite.com ----> foobar.com:8000. The main configuration will be like this: create a multi-site listener, use frontend port 80 and hostname aaaa.mysite.com in this multi-site listener. HTTP setting should specify the port 8000. Make sure the listener is listening on port 80 and HTTP setting configure your custom port for your backend websites.

In this case, you will create 3 Listeners with on same port 80,and specify the hostnames and create 3 HTTP settings, and create rules with corresponding Listener and HTTP settings and backend pool.

The Azure front door also has URL-based routing and Multiple-site hosting ability. Refer to this document.

Update

Backend pools

Create one backend pool and set your Azure VM as the backend in the backend pool.

Listeners

Click multi-site to create a multi-site listener then save it. You need three listeners for your host name. enter image description here Type the subdomains as the host name enter image description here

Health probes

Add a health probe and checkbox pick host name from backend http settings. enter image description here

HTTP settings

Add three HTTP settings and specify the custom port on each of HTTP settings. enter image description here

Rules

Add three basic rules with corresponding Listener and HTTP settings and backend pool. enter image description here

于 2019-08-19T08:27:25.953 回答