实验环境:网站及DNS服务提供端:centos6.5
客户端:win7
基于相同端口,相同IP地址搭建不同站点
vim /etc/httpd/conf.d/host.conf ????????????????????????????//编辑虚拟主机配置文件
输入以下内容
NameVirtualHost 192.168.10.10:80
<VirtualHost 192.168.10.10:80>
ServerAdmin ?webmaster@dummy-host.example.com
DocumentRoot /opt/benet/
ServerName www.benet.com
ErrorLog logs/benet.com-error_log
CustomLog logs/benet.com-access_log common
</VirtualHost>
<VirtualHost 192.168.10.10:80>
ServerAdmin ?webmaster@dummy-host.example.com
DocumentRoot /opt/yun/
ServerName www.yun.com
ErrorLog logs/yun.com-error_log
CustomLog logs/yun.com-access_log common
</VirtualHost>
echo "this is benet" > /opt/benet/index.html ??????// "this is benet"为bennet.com的首页文件
echo "this is yun" > /opt/yun/index.html ?????????///"this is yun"为yun.com的首页文件
搭建DNS解析服务
rpm -ivh /mnt/Packages/bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm ???//安装DNS环境软件包
vim /etc/named.conf ????????????????????????????????????????//编辑DNS主配置文件
vim /etc/named.rfc1912.zones ???????????????????//编辑区域配置文件
zone "benet.com" IN {
type master;
file "benet.com.zone";
allow-update { none; };
};
zone "yun.com" IN {
type master;
file "yun.com.zone";
allow-update { none; };
};
cd /var/named/
cp -p named.localhost benet.com.zone
vim benet.com.zone
cp -p benet.com.zone yun.com.zone
vim yun.com.zone
客户端分别访问网页:www.benet.com ,www.yun.com
百晓生带你玩转linux系统服务搭建系列----构建虚拟ApacheWeb主机
原文地址:http://blog.51cto.com/13842738/2159188