配置基于域名的虚拟主机
1、配置dns服务提供域名解析
1.挂载光盘
[root@centos01 ~]# mount /dev/cdrom /mnt/
2.安装dns
[root@centos01 ~]# yum -y install bind bind-utils bind-choot
3.修改备份主配置文件
[root@centos01 ~]# cp /etc/named.conf /etc/named.conf.bak
[root@centos01 ~]# echo “” > /etc/named.conf
[root@centos01 ~]# vim /etc/named.conf
4.修改区域文件
[root@centos01 ~]# vim /var/named/bdqn.com.zone
[root@centos01 ~]# vim /var/named/jbit.com.zone
5.开启
[root@centos01 ~]# systemctl start named
6.创建网站根目录
[root@centos01 ~]# mkdir /var/www/html/bdqncom
[root@centos01 ~]# mkdir /var/www/html/jbitcom
[root@centos01 ~]# echo “www.bdqn.com” > /var/www/html/bdqncom/index.html
[root@centos01 ~]# echo “www.jbit.com” > /var/www/html/jbitcom/index.html
[root@centos01 ~]# vim /usr/local/httpd/conf/httpd.conf
修改虚拟机主配置文件
[root@centos01 ~]# vim /usr/local/httpd/conf/extra/httpd-vhosts.conf
验证