ApacheConfiguration of the virtual host
* Condition: include httpd-vhosts.conf in http.conf
* # Virtual hosts
Include conf/extra/httpd-vhosts.conf
* Configured in httpd-vhost.conf
* (1) IP-based virtual host
* Modify the Hosts file to add 3 domain names to the corresponding
* 192.168.1.11 www.test1.com
* 192.168.1.12 www.test2.com
* 192.168.1.13 www.test3.com
* Establish the root directory of the virtual hosting file, as
* www/test1/1.html
* www/test2/2.html
* www/test3/3.html
* The following configuration is performed in httpd-vhosts.conf
*
* ServerName www.test1.com
* DocumentRoot "Www/test1"
*
* Options Indexs Followsyslinks
* AllowOverride None
* Order allow Deny
* Allow from all
* DirectoryIndex index.html index.htm index.php
*
*
*
*
ServerName www.test2.com
documentroot/www/test2/
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
*
*
ServerName www.test3.com
documentroot/www/test3/
Options Indexes FollowSymLinks
AllowOverride None
Order Allow,deny
Allow from all
*
* (2) based on host name
* Set domain name Mapping with one host
* 192.168.1.10 www.test1.com
* 192.168.1.10 www.test2.com
* 192.168.1.10 www.test3.com
* Set the root directory where the Web page resides
* www/test1/1.html
* www/test2/2.html
* www/test3/3.html
* When using a domain-based virtual host, you must specify the IP address and possible access port of the server to allow the host to accept the request and
* Use the NAMEVIRTUALHOST directive to configure, if all the IP on the server will be used, you can use * to represent,
* IP specified in namevirtualhost does not allow the server to listen to this IP
* Then configure
* If you configure the virtual host on an existing Web server, you must also configure the existing virtual host , where
* ServerName and DocumentRoot contain content that is consistent with the global content and should be placed at the front of the configuration file.
* As the default host configuration
* Namevirtualhost *:80
*
* ServerName www.test1.com
* DocumentRoot "Www/test2"
*
* Options Indexs FollowSymLinks
* AllowOverride None
* Order Allow,deny
* Allow from all
*
*
* *
* ServerName www.test2.com
* DocumentRoot "Www/test2"
*
* Options Indexs FollowSymLinks
* AllowOverride None
* Order Allow,deny
* Allow from all
*
*
* *
* ServerName www.test3.com
* DocumentRoot "Www/test3"
*
* Options Indexs FollowSymLinks
* AllowOverride None
* Order Allow,deny
* Allow from all
*
*
*
* (3) Port-based
* Modify httpd.conf
* Set to Listen 8001
* Listen 8002
* Modify the virtual host configuration file httpd-vhosts.conf
*
* ServerName www.test1.com
* DocumentRoot "Www/test1"
*
* *
* ServerName www.test2.com
* DocumentRoot "Www/test2"
*
The above describes the Apache virtual host configuration, including the Apache aspect of the content, I hope that the PHP tutorial interested in a friend helpful.