IP address-based virtual host IP Address: 172.16.34.3/16:80;172.16.34.30/16:80
Linux version: centos6.7
httpd version: 2.2.15
This experiment requires that SELinux be closed
Installing httpd
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/84/0F/wKioL1eEmprx-As2AAInf6-FSkw831.jpg "title=" 1.jpg " alt= "Wkiol1eemprx-as2aainf6-fskw831.jpg"/>
Add and view IP addresses
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/84/0F/wKioL1eEmrbxAR9zAAI27mT4TaM708.jpg "title=" 2.jpg " alt= "Wkiol1eemrbxar9zaai27mt4tam708.jpg"/> A configuration example of a virtual host in configuration/etc/httpd/conf/httpd.conf:
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/84/0F/wKioL1eEmsXx4-iYAADPAhusH-c408.jpg "title=" 3.jpg " The alt= "wkiol1eemsxx4-iyaadpahush-c408.jpg"/> can be added here, or a virtual host file can be created in the/etc/httpd/conf.d/directory; It is recommended that each virtual host create a profile
switch directories to/etc/httpd/conf.d/; Create a new profile with the name "Ip.conf" (the name is arbitrary and the order must end with a. conf suffix); IP differs:
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/84/0F/wKioL1eEmuCBOzfjAAAoqkp2p7g802.jpg "style=" float: none; "title=" 4.jpg "alt=" Wkiol1eemucbozfjaaaoqkp2p7g802.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/84/10/wKiom1eEmuCisncxAAAfaPfCA_k240.jpg "style=" float: none; "title=" 5.jpg "alt=" Wkiom1eemucisncxaaafapfca_k240.jpg "/>
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/84/10/wKiom1eEmuCDgYNlAACpHg36ftw501.jpg "style=" float: none; "title=" 6.jpg "alt=" Wkiom1eemucdgynlaacphg36ftw501.jpg "/>
create the appropriate directory folder; index.html File
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M01/84/10/wKiom1eEmvyx1PFHAACXG07bs_s442.jpg "style=" float: none; "title=" 7.jpg "alt=" Wkiom1eemvyx1pfhaacxg07bs_s442.jpg "/>
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/84/0F/wKioL1eEmvzBoV47AABFP_N1TE0544.jpg "style=" float: none; "title=" 8.jpg "alt=" Wkiol1eemvzbov47aabfp_n1te0544.jpg "/>
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/84/10/wKiom1eEmv3jR6_mAAATkAduk7I325.jpg "style=" float: none; "title=" 9.jpg "alt=" Wkiom1eemv3jr6_maaatkaduk7i325.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/84/0F/wKioL1eEmv2wlzmXAAA4945QL18188.jpg "style=" float: none; "title=" 10.jpg "alt=" Wkiol1eemv2wlzmxaaa4945ql18188.jpg "/>
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/84/0F/wKioL1eEmv2xuzTjAAAQg-tBB_M893.jpg "style=" float: none; "title=" 11.jpg "alt=" Wkiol1eemv2xuztjaaaqg-tbb_m893.jpg "/>
Check for syntax errors and restart service
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M01/84/0F/wKioL1eEmyLB8g4OAAAk-KEwazA744.jpg "style=" float: none; "title=" 12.jpg "alt=" Wkiol1eemylb8g4oaaak-kewaza744.jpg "/>
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/84/0F/wKioL1eEmyKytBmLAABK5fJZ5EI444.jpg "style=" float: none; "title=" 13.jpg "alt=" Wkiol1eemykytbmlaabk5fjz5ei444.jpg "/>
Access separately
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/84/10/wKiom1eEmobB4sAZAAApa0cCAm4349.jpg "style=" float: none; "title=" 14.jpg "alt=" Wkiom1eemobb4sazaaapa0ccam4349.jpg "/>
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/84/0F/wKioL1eEmobTfE0fAAAyVe6isRc017.jpg "style=" float: none; "title=" 15.jpg "alt=" Wkiol1eemobtfe0faaayve6isrc017.jpg "/>
Port-based virtual host (some files are obtained by modifying the IP-based virtual host experiment)
Modify the/etc/httpd/conf/httpd.conf configuration file, add a listening port, add 8080 port here
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/84/0F/wKioL1eEmz7A7kw6AAD3OHXYutU369.jpg "title=" 16.jpg "alt=" wkiol1eemz7a7kw6aad3ohxyutu369.jpg "/> reload The configuration file and verify that it is in effect
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/84/10/wKiom1eEm5TQfWkiAAC1i0Azv9s487.jpg "title=" 17.jpg "alt=" wkiom1eem5tqfwkiaac1i0azv9s487.jpg "/> new profile new configuration file with Name" port.conf "; different port number of the same IP
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/84/10/wKiom1eEm7mSnys5AACvrZ9RKjo509.jpg "title=" 18.jpg "alt=" Wkiom1eem7msnys5aacvrz9rkjo509.jpg "/>
Check syntax
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/84/0F/wKioL1eEm9KBygHaAAAk-KEwazA200.jpg "style=" float: none; "title=" 19.jpg "alt=" Wkiol1eem9kbyghaaaak-kewaza200.jpg "/>
Access Port
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/84/10/wKiom1eEm9OSiIFuAABCwkCM5Ao518.jpg "style=" float: none; "title=" 20.jpg "alt=" Wkiom1eem9osiifuaabcwkcm5ao518.jpg "/>
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/84/10/wKiom1eEm9OABaWSAAA7Ifx7iNk398.jpg "style=" float: none; "title=" 21.jpg "alt=" Wkiom1eem9oabawsaaa7ifx7ink398.jpg "/>
FQDN-based virtual host
New/etc/httpd/conf.d/fqdn.conf, same IP, same port number, host name is different
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/84/0F/wKioL1eEm_XBw60PAACoS4MrOPw358.jpg "title=" 22.jpg "alt=" Wkiol1eem_xbw60paacos4mropw358.jpg "/>
Check syntax:
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/84/0F/wKioL1eEnBChE1Y6AACs6sfvmEY917.jpg "title=" 23.jpg "alt=" wkiol1eenbche1y6aacs6sfvmey917.jpg "/> here to enable" Namevirtualhost "
Edit/etc/httpd/conf/httpd.cofg
The address here needs to be the same as the address edited in the/etc/httpd/conf.d/fqdn.conf file
650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M00/84/10/wKiom1eEnCHy1wFFAABOfrmccKo342.jpg "title=" 24.jpg "alt=" Wkiom1eenchy1wffaabofrmccko342.jpg "/>
Verify the syntax again
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/84/0F/wKioL1eEnDTTZVkuAAAlKBYTE2w061.jpg "style=" float: none; "title=" 25.jpg "alt=" Wkiol1eendttzvkuaaalkbyte2w061.jpg "/>
Add two resolved addresses to the/etc/hosts file
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/84/10/wKiom1eEnDWA3T83AACoi_XnlSg794.jpg "style=" float: none; "title=" 26.jpg "alt=" Wkiom1eendwa3t83aacoi_xnlsg794.jpg "/>
Reread configuration Files
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/84/0F/wKioL1eEnDXQq7svAAA3lzgTcC4231.jpg "style=" float: none; "title=" 27.jpg "alt=" Wkiol1eendxqq7svaaa3lzgtcc4231.jpg "/>
Authentication access (This is done by modifying the Hosts file to verify, if the regular public domain name, directly using the domain name can be accessed)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/84/10/wKiom1eEnDWwNNaZAABqM6rjIUI950.jpg "style=" float: none; "title=" 28.jpg "alt=" Wkiom1eendwwnnazaabqm6rjiui950.jpg "/>
Apache httpd Three ways to configure a virtual host