Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
What is a VM service?
A virtual host service virtualizes a machine into multiple WEB servers. For example, a company wants to provide host hosting services, which provides WEB services for other enterprises. Therefore, it certainly does not prepare a physical server for each enterprise, but uses a large server with powerful functions and then uses a virtual host, it provides WEB services for multiple enterprises. Although all WEB services are provided by this server, visitors can see that they have the same WEB services on different servers.
Specifically, we can use the VM service to store the home pages of www.company1.com and www.company2.com of two different companies on the same host. Visitors only need to enter the domain name of the company to access the homepage content they want.
You can use Apache to set up the VM service in two ways: IP address-based virtual host and name-based virtual host. The following describes their implementation methods. So that you can select the most appropriate implementation method in specific applications.
Set and implement IP address-based VM service
In this way, you need to set the IP alias on the machine, that is, bind multiple
IP addresses are used to serve multiple VM instances. To use this function, make sure that the IP alias settings must be supported in your Linux kernel. Otherwise, you must re-compile the kernel.
The following is a service setting with two virtual hosts for your reference.
2. Configuration steps
Assume that the machine we use to implement the VM service already provides the WEB service for ourselves. Now we will provide the VM service for www.company1.com, a new company.
Planned IP address: apply for a new IP address for the VM. (Assume that the local IP address is 184.108.40.206)
2) enable the ISP to resolve the domain name.
3) set an IP alias for the NIC:
/Sbin/ifconfig eth0: 0 220.127.116.11 netmask 255.255.255.0
4) reset "/etc/httpd/conf/httpd. conf" and add the following to the file:
5) create a directory.
6) store the corresponding homepage content in the corresponding directory.
3. Unfavorable factors
There is a serious deficiency in the implementation of such virtual hosts, that is, each time a virtual host is added, an IP address must be added. Because the IP address space is very tight, it is usually impossible to obtain so many IP addresses. In a sense, this is also a waste of IP addresses.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.