You can build multiple sites on an ECS instance by creating virtual sub-directories. Server Load Balancer supports adding this type of ECS instance as a backend server to forward traffic. Both layer-4 and layer-7 Server Load Balancer support adding multi-site ECS instances and the function is not influenced by session persistence.
This tutorial illustrates how to create a TCP listener and add an ECS instance deployed with two sites.
On the ECS01, create the site www.aaa.com and the site www.bbb.com through creating sub-directories.
The content displayed on the site www.aaa.com is shown as the following figure.
The content displayed on the site www.bbb.com is shown as the following figure.
You can bind the two domain names to the public IP address of the ECS instance in the local host file and use the browser to visit ww.aaa.com and www.bbb.com. If the preceding contents are displayed, the configuration is successful.
Create a custom image for the ECS01 and use the image to create ECS02 with the same configuration.
Create an Internet Server Load Balancer instance and add a TCP listener.
Add the ECS01 and the ECS02 as backend servers.
In the local host file, resolve the domain name www.aaa.com and the domain name www.bbb.com to the public IP address of the Server Load Balancer instance.
Enter www.aaa.com and www.bbb.com in the browser. If the corresponding backend services can be accessed, the deployment is successful.