Build a virtual host-- based on domain name
Virtual Web host
1. Run multiple Web sites on the same physical server, each of which is not independent
Take up a real computer
2. Types of virtual hosts supported by httpd
● domain name-based virtual host (commonly used, for enterprise use)
● virtual host based on IP address (at least 2 IP on one host, impractical)
● port-based virtual host
Three types: different IP, different port, different domain name
Experimental configuration
Open a Linux and a win7 host
1. Set the dns master configuration file
2. Set the dns zone configuration file
3. Set the dns zone data configuration file
(1) configure data content for kgc.com.zone
(2) configure data content for kgc02.com.zone
4. Add virtual host configuration under the configuration file of httpd
5. Prepare the web page documents for the virtual host
[root@www ~] # mkdir-p / var/www/html/kgc [root@www ~] # mkdir-p / var/www/html/kgc02 [root@www ~] # echo "this kgc web" > / var/www/html/kgc/index.html [root@www ~] # echo "this is kgc02 web" > / var/www/html/kgc02/index.html
6. Boot and load the virtual host configuration file in the httpd main configuration file
7. Turn off the firewall and security function. Start the httpd and named services. Win 7 visits two domain names and displays two different web pages.
Thank you for watching!