Based on IP
Yum Install Httpd-y
Service httpd Start
Chkconfig httpd on
Vi/etc/httpd/conf/httpd.conf
# Document
<virtualhost 192.168.100.100:80>
ServerName www.benet.com
Documentroot/www/benet.com
</VirtualHost>
<virtualhost 192.168.100.110:80>
ServerName www.accp.com
Documentroot/www/accp.com
</VirtualHost>
Mkdir-pv/www/{benet.com,accp.com}
cd/www/benet.com/
VI index.html
<title>benet</title>
Cd..
CD accp.com/
VI index.html
<title>accp</title>
Service httpd Restart
IP address add 192.168.100.100/24 dev eth0
IP address add 192.168.100.110/24 dev eth0
IP addr Show
Port-based
Vi/etc/httpd/conf/httpd.conf
<virtualhost 192.168.100.100:80>
ServerName www.benet.com
Documentroot/www/benet.com
</VirtualHost>
<virtualhost 192.168.100.110:8080>
ServerName www.huawei.com
Documentroot/www/huawei.com
</VirtualHost>
<virtualhost 192.168.100.100:80>
ServerName www.benet.com
Documentroot/www/benet.com
</VirtualHost>
cd/www/
mkdir huawei.com
CD huawei.com/
VI index.html
<title>huawei</title>
Service httpd Restart
Vi/etc/httpd/conf/httpd.conf
#Listen 12.34.56.78:80
Listen 80
Listen 8080
Service httpd Restart
Domain-based
View/etc/httpd/conf.d/virtual.conf
Namevirtualhost 192.168.100.110:80
<virtualhost 192.168.100.110:80>
ServerName blog.csdn.net
Documentroot/www/csdn.net
</VirtualHost>
Mkdir-p/www/csdn.net/
cd/www/csdn.net/
VI index.html
<title>csdn</title>
Service httpd Restart
Win7 windows/systrm32/drivers/etc/hosts
192.168.100.110 www.accp.com
192.168.100.110 blogs.csdn.net
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/96/31/wKioL1kdvw2g_ApMAABmofu4S7g712.png-wh_500x0-wm_ 3-wmp_4-s_1015077866.png "style=" Float:none; "title=" 2017-05-18_16-24-51.png "alt=" Wkiol1kdvw2g_ Apmaabmofu4s7g712.png-wh_50 "/>
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/96/31/wKioL1kdvw2zZhzEAAB0RCw5WFA201.png-wh_500x0-wm_ 3-wmp_4-s_3222763345.png "style=" Float:none; "title=" 2017-05-18_16-25-21.png "alt=" Wkiol1kdvw2zzhzeaab0rcw5wfa201.png-wh_50 "/>
Web site services based on IP, port, domain name