Apache Build virtual web Host

Source: Internet
Author: User
Tags web hosting

Virtual Host

A virtual Web host refers to running multiple Web sites on the same server, each of which does not actually occupy the entire server on its own, so it is called a "virtual" web host. The virtual web hosting service enables you to take advantage of server hardware resources to reduce site build and run costs.


Apache virtual Web host is divided into three types
Domain-based: Each virtual machine uses a different domain name, the same IP
IP-based: Each virtual machine uses a different domain name and corresponds to a different IP
Based on different port numbers: same IP, different TCP ports
Work is often based on a different domain name of the virtual host, the other two virtual host is not a lot of running.

experimental Environment: Linux6.5 system

IP Address: 192.168.100.10

Client IP Address: 192.168.100.22

Yum Mount directory:/mnt/sr0

Experimental Objectives

1. Build a virtual directory

2. Build a domain-based virtual host

3. Build a virtual host based on different port numbers

Note: The virtual host based on IP address is rarely used in practical applications, this experiment is not done here!

Experimental Steps

1. Create a virtual directory

[email protected] conf.d]# vim test.conf

[[email protected] conf.d]# mkdir/opt/test/Create virtual User Directory
[Email protected] conf.d]# echo "This is a VDir test" >/opt/test/index.htmlzidyi

/write Site Content

[[Email protected] conf.d]# service httpd restart/restart services

[[Email protected] conf.d]# service iptables stop/Shut down firewall
[[email protected] conf.d]# Setenforce 0/off security

2. Check the client for verification, using thehttp://192.168.10.10/test/进行访问

3. Turn on user authentication

[Email protected] conf.d]# vim test.conf

4. Create User and password

5. View on Client

Second, build a virtual host based on different domain names

1. Same IP same port different host name Benet and ACCP

[email protected] conf.d]# vim vdirhost

2. Create separate directories and write to different site content

[[email protected] conf.d]# mkdir/opt/benet/Create virtual User Benet Directory
[[email protected] conf.d]# Mkdir/opt/yun/Create virtual User Yun Directory

[[email protected] conf.d]# echo "This is Benet" >/opt/benet/index.html/Site Write content

[[email protected] conf.d]# echo "This is Yun" >/opt/yun/index.html/write Content


4. Set up DNS resolution on the client and verify



[[email protected] conf.d]# mkdir/opt/benet01/build Directory

[[email protected] conf.d]# echo "This is benet01" >/opt/benet01/index.html/write site content

2. Modify the Apache master configuration

[Email protected] conf.d]# vim/etc/httpd/conf/httpd.conf

3. Restart the service

[[Email protected] conf.d]# service httpd restart/restart services

4. Client Authentication

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.