The following article will cover how to ‘map’ a domain to an Elastic Compute Service (ECS) instance. Please note that the concept of resolving a domain name to a server IP is the same regardless of the cloud service provider.
To map a domain to one of your ECS server instances, Load Balancer (LB) or any service that can respond to HTTP traffic) you must first own the domain name. After ownership of the domain has been verified your domain name will appear under the “Alibaba Cloud DNS” service. To make use of your new domain, configure the domain by adding or updating DNS entries.
Below image is an example of the DNS settings for “mycloudology.com” with two A records. Both records are mapping to an ECS server instance public IP.
You can test the new DNS setup using a web browser and navigate to the domain URL. The domain URL should resolve to the expected IP.
Alternatively, you can test the DNS setup by performing the following command to see if the domain names resolve to the expected IP:
Configure web server
Having the correct DNS settings will only direct the web traffic to the expected server or service. When using a web server like Nginx, Apache or IIS you will likely need to configure the web server so that the request is handled accordingly.
Below is an example of Nginx being used as a proxy server, traffic is being directed according to the domain and host of the request.