Build Web Services using Apache (iii) building Web virtual hosts

Source: Internet
Author: User
Tags mkdir web services port number root directory

A virtual web host is called a "virtual Web host" by running multiple Web sites on the same server, each of which does not actually occupy the entire server independently. When building a virtual Web host, you can use three ways to build virtual Web services, based on IP addresses, port-based and domain-based. It is common to build virtual Web hosts based on domain names. So let's take a look at how to build these three different virtual web hosts.

IP address based virtual host: For each virtual host using a different domain name, different IP to achieve.

Port based virtual host: This way is not used domain names, IP addresses to differentiate, but using a different port number to implement.

Domain-based virtual host: Use a different domain name for each virtual host, and the IP address and port number are unchanged.

Preparatory work

1, before building a virtual host we first create two different Web site root directory, and create the first file.

[Root@localhost/] #mkdir/usr/local/httpd/htdocs/benet

[Root@localhost/] #mkdir/USR/LOCAL/HTTPD/HTDOCS/ACCP

[Root@localhost/] #echo "

[Root@localhost/] #echo "

2, the establishment of DNS services for the virtual host to provide domain name resolution services.

How to build a DNS service please refer to article: RHEL 5 service-Deploying DNS domain name Resolution Service

3. Build the virtual Web host. It is recommended that you use a stand-alone virtual configuration file and then load these configurations through Lnclude in the httpd.conf file, which minimizes changes to httpd.conf files and facilitates the maintenance of configuration content.

Virtual host based on IP address

Use this way everyone virtual host, most of the use of domain-based approach. When building a virtual host based on an IP address, you need to add multiple network card devices to the host.

[Root@localhost/] #vim/usr/lcoal/httpd/conf/extra/httpd-vhosts.conf//Create a separate configuration file

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.