基于ip
yum install httpd -y
service httpd start
chkconfig httpd on
vi /etc/httpd/conf/httpd.conf
# Document
ServerName www.benet.com
DocumentRoot /www/benet.com
ServerName www.accp.com
DocumentRoot /www/accp.com
mkdir -pv /www/{benet.com,accp.com}
cd /www/benet.com/
vi index.html
cd ..
cd accp.com/
vi index.html
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
基于端口
vi /etc/httpd/conf/httpd.conf
ServerName www.benet.com
DocumentRoot /www/benet.com
ServerName www.huawei.com
DocumentRoot /www/huawei.com
ServerName www.benet.com
DocumentRoot /www/benet.com
cd /www/
mkdir huawei.com
cd huawei.com/
vi index.html
service httpd restart
vi /etc/httpd/conf/httpd.conf
#Listen 12.34.56.78:80
Listen 80
Listen 8080
service httpd restart
基于域名
view/etc/httpd/conf.d/virtual.conf
nameVirtualHost 192.168.100.110:80
ServerName blog.csdn.net
DocumentRoot /www/csdn.net
mkdir -p /www/csdn.net/
cd /www/csdn.net/
vi index.html
service httpd restart
win7 windows/systrm32/drivers/etc/hosts
192.168.100.110 www.accp.com
192.168.100.110 blogs.csdn.net

