Apache Build virtual web Host

Source: Internet
Author: User

Apache Build virtual web Host
Knowledge section
1. Virtual Web host refers to running multiple Web sites on the same server, one of which is common to one server. Running a Web site from a virtual web host can save hardware resources and reduce operational costs.
2. Apache virtual Web host is divided into three kinds
Virtual hosts based on different domain names
Virtual hosts based on different IP addresses
and virtual hosts based on different port numbers
Work is often based on a different domain name of the virtual host, the other two virtual host is not a lot of running.
Operation section
Idea: The first to do a domain-based virtual host, we need to set up two Web sites corresponding DNS resolution support
First: Get ready to install Apache services and DNS services on a single Linux server.
1, install the DNS service is installed bind-9 and Bind-chrootPackage.
2, configure the DNS master file; vim/var/named/chroot/etc/named.conf file

3, configuration benet area data file; vim/var/named/chroot/var/named/benet.com.zone

4, configuration ACCP area data file; vim/var/named/chroot/var/named/accp.com.zone

5. Prepare the required pages for two


6, edit the virtual host configuration file; vim/usr/local/httpd/conf/extra/http-vhosts.conf
Locate the underlined position and make the following changes

Until you find it, modify

7, modify the Apache master configuration file; vim/usr/local/httpd/conf/httpd.conf
Find the following location and delete the "#" before the Include

8. Restart the httpd and named services. (Configure address, turn off firewall)

9, open a Win7, as the Web client, configure the address 192.168.1.200, and then access www.benet.com and www.accp.com


Idea: The second type of virtual host based on different IP addresses. First we need to configure an IP address for the Web server and then change the virtual host configuration file. (DNS is useless at this time)
1. Add IP Address

2. Change the virtual host configuration file httpd-vhosts.conf

3. Restart HTTPD Service
4, landing on the Win7 192.168.1.1 and 192.168.1.2


Idea: Third, a virtual host based on a different port. The Benet remains the same, and we modify the httpd-vhosts.conf and the main provisioning file. (The main configuration file by default listening to 80 port, that is, httpd default port, now to use a different port, you need to set up in the main file to listen to a new port)
1. Modify the virtual host configuration file httpd-vhosts.conf

2, modify the main file httpd.conf

3, landing on the Win7 http://www.benet.com:80 and http://www.accp.com:801. Note that the input URL is preceded by "HTTP//", otherwise the port can not be logged

Apache Build virtual web Host

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.