Domain-based virtual Web Host
Lab Environment:
a public network used by a company's Web server IP address is 192.168.100.150 , and use the IP Address registration two domain names www.bdqn.com and the www.jbit.com . The server is already well- centos6.5 operating system, and the source code compiled by the way installed the Web Server Software httpd-2.2.17, you now need to configure the httpd service to support the simultaneous running of these two Web site.
Topology:
Requirements Description:
? site www.bdqn.com Web document is stored in the server's /var/www/html/bdqndoc directory.
? site www.jbit.com Web document is stored in the server's /var/www/html/jbitdoc directory.
? build a domain-based virtual host server to support the above two Web site
? which www.jbit.com The site is only open to employees within the company. User authentication required for access
Experimental steps
One: Provide domain name resolution for virtual host
1) Build a DNS server, responsible for resolving domain names www.bdqn.com and the www.jbit.com
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image002 "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M02/86/E0/ Wkiom1fnpnrthfaxaabbrruyias178.jpg "" 504 "height=" 157 "/>
Modify DNS master configuration file, adding forward parsing
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image004 "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M00/86/E0/ Wkiom1fnpnugzbsraac-cn5-boq820.jpg "" 504 "height=" 420 "/>
Editing a zone configuration file
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image006 "border=" 0 "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M01/86/E0/ Wkiom1fnpnzys5lsaacokf5__c0343.jpg "" 504 "height="/>
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image008 "border=" 0 "alt=" clip_image008 "src=" http://s3.51cto.com/wyfs02/M00/86/DF/ Wkiol1fnpn2qkja2aacrvtw1ln8622.jpg "" 504 "height=" 424 "/>
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image010 "border=" 0 "alt=" clip_image010 "src=" http://s3.51cto.com/wyfs02/M01/86/DF/ Wkiol1fnpn7qex4saac9ybyvoqq985.jpg "" 504 "height=" 420 "/>
Restart DNS Service
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image012 "border=" 0 "alt=" clip_image012 "src=" http://s3.51cto.com/wyfs02/M00/86/E0/ Wkiom1fnpn_dkl5taacybozoogy096.jpg "" 504 "height=" 390 "/>
Analytic testing
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image014 "border=" 0 "alt=" clip_image014 "src=" http://s3.51cto.com/wyfs02/M02/86/DF/ Wkiol1fnpohrw9iuaacnbfqe-e0766.jpg "" 504 "height=" 401 "/>
Second: Prepare Web page documents for virtual host
1) Create /var/www/html/bdqndoc folder, as a Web site www.bdqn.com the root directory.
2) Create /var/www/html/jbitdoc folder, as a Web site www.jbit.com the root directory.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image016 "border=" 0 "alt=" clip_image016 "src=" http://s3.51cto.com/wyfs02/M02/86/DF/ Wkiol1fnpogg_re3aabpzvmtobi477.jpg "" 504 "height="/>
3) set up in the above two folders index.html files, and write different Web content.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image018 "border=" 0 "alt=" clip_image018 "src=" http://s3.51cto.com/wyfs02/M01/86/E0/ Wkiom1fnpokbex5naactuyhjjko239.jpg "" 504 "height=" 234 "/>
Three: Configure and start httpd Server
1) write a separate virtual host configuration file and include configuration items are loaded into httpd.conf file.
Backing up the virtual host configuration file
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image020 "border=" 0 "alt=" clip_image020 "src=" http://s3.51cto.com/wyfs02/M02/86/E0/ Wkiom1fnpoodgu70aadku-9jroq941.jpg "" 504 "height=" 290 "/>
Edit a virtual host configuration file
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image022 "border=" 0 "alt=" clip_image022 "src=" http://s3.51cto.com/wyfs02/M01/86/E0/ Wkiom1fnpottsz1aaablvjbf6t0810.jpg "" 504 "height=" 215 "/>
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image024 "border=" 0 "alt=" clip_image024 "src=" http://s3.51cto.com/wyfs02/M01/86/DF/ Wkiol1fnpowsbpo4aacm1enbrsy594.jpg "" 504 "height=" 229 "/>
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image026 "border=" 0 "alt=" clip_image026 "src=" http://s3.51cto.com/wyfs02/M02/86/E0/ Wkiom1fnpofxr2-7aaekjgrykkg421.jpg "" 504 "height=" 435 "/>
Modify Web Service Master configuration file
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image028 "border=" 0 "alt=" clip_image028 "src=" http://s3.51cto.com/wyfs02/M00/86/E0/ Wkiom1fnpoiwl1bnaaa_3k3yphi383.jpg "" 504 "height=" 151 "/>
Remove include previous comments, loading the virtual host configuration file into the master profile
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image030 "border=" 0 "alt=" clip_image030 "src=" http://s3.51cto.com/wyfs02/M02/86/DF/ Wkiol1fnpomyvi3daadc2l0kghc398.jpg "" 504 "height=" 343 "/>
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image032 "border=" 0 "alt=" clip_image032 "src=" http://s3.51cto.com/wyfs02/M00/86/DF/ Wkiol1fnporijk5waabrtjrheeu297.jpg "" 504 "height=" 352 "/>
2) Use htpasswd tool to create user authentication data files and add authorized users Alan,agou .
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image034 "border=" 0 "alt=" clip_image034 "src=" http://s3.51cto.com/wyfs02/M01/86/DF/ Wkiol1fnpovtwiqkaadqevocnt8377.jpg "" 504 "height=" 355 "/>
3) for directory /var/www/html/jbitdoc Add Directory zone, and set user access authorizations.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image036 "border=" 0 "alt=" clip_image036 "src=" http://s3.51cto.com/wyfs02/M02/86/DF/ Wkiol1fnpoujzm-eaaa-71sb0_0070.jpg "" 504 "height=" 188 "/>
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image038 "border=" 0 "alt=" clip_image038 "src=" http://s3.51cto.com/wyfs02/M00/86/E1/ Wkiom1fnpoyxptv5aadj7rapk7a228.jpg "" 504 "height=" 435 "/>
4) Restart httpd server program, and confirm the port's listening status
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image040 "border=" 0 "alt=" clip_image040 "src=" http://s3.51cto.com/wyfs02/M00/86/E0/ Wkiol1fnpo3jfrgzaab_dkfotjc591.jpg "" 504 "height=" 222 "/>
Four: Accessing the virtual Host in the client
1) visit the site separately www.bdqn.com and the www.jbit.com , should be able to see the page content that is not used.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image042 "border=" 0 "alt=" clip_image042 "src=" http://s3.51cto.com/wyfs02/M01/86/E1/ Wkiom1fnpo7i69c1aabctmabhno788.jpg "" 504 "height="/>
2) when you visit a site www.jbit.com , the user authentication window pops up and is allowed access after authentication.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image044 "border=" 0 "alt=" clip_image044 "src=" http://s3.51cto.com/wyfs02/M01/86/E1/ Wkiom1fnpo-bboboaaclyrnfcxu959.jpg "" 504 "height=" 509 "/>
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image046 "border=" 0 "alt=" clip_image046 "src=" http://s3.51cto.com/wyfs02/M02/86/E1/ Wkiom1fnppdak3i4aabwzhwulqc826.jpg "" 504 "height=" 339 "/>
Summarize:
1. httpd service through order,allow from, anddeny from Configuration Items implement client address access control.
2. httpd service through authname,authtype,authuserfile and require valid-user configuration items to implement the user authorization of the directory.
3. When you set up user authorization for a site directory, you need to first create a user authentication data file from the HTPASSWD tool.
4. The Httpd Service supports three types of virtual virtual Web hosts, namely domain-based, IP -based Address, a port-based virtual host.
LQC_ building a domain-based virtual host