2020-11-25

第一章 Web服务器

网络拓扑图:在这里插入图片描述
实验环境描述:
某公司根据其信息化建设要求,需要构建一台独立配置的网站服务器。考虑到站点的运行效率,稳定性及可扩展性等因素,要求在CentOS 7 系统中构建httpd服务器,并使用httpd-2.2.17源码版本进行编译安装。
实验环境:
编译安装httpd服务器,要求支持动态模块扩展、地址重写、多字符集。
网站名称设置为www.bdqn.com,默认首页设置为index.html和index.php。
将/usr/share/doc/HTML/zh-CN/目录下的index.html复制到网站根目录下并改名为redhat。
在浏览器中分别访问http://www.bdqn.com/redhat与http://www.bdqn.com/,查看不同的测试页面。
推荐步骤:
1.开启一台虚拟机作为WEB服务器,编译安装httpd软件包
2.另开一台虚拟机,配置DNS服务
3.验证
实验步骤:
WEB服务器:
1.挂载linux光盘到/mnt目录
[root@centos01 ~]# mount /dev/cdrom /mnt
2.查看挂载目录数据
[root@centos01 ~]# ls /mnt/
3.将源代码程序解压到/usr/src目录
[root@centos01 ~]# tar zxvf /mnt/httpd-2.2.17.tar.gz -C /usr/src
4.切换到apache程序目录
[root@centos01 ~]# cd /usr/src/httpd-2.2.17/
5.配置apache
[root@centos01 httpd-2.2.17]# ./configure --prefix=/usr/local/httpd --enable-so --enable-charset-lite --enable-rewrite --enable-cgi
6.编译安装apache
[root@centos01 httpd-2.2.17]# make && make install
7.查看是否安装成功
[root@centos01 httpd-2.2.17]# ls -ld /usr/local/httpd/
8.优化apache服务
[root@centos01 ~]# ln -s /usr/local/httpd/bin/* /usr/local/bin/
9.检查配置文件的完全性
[root@centos01 ~]# apachectl -t
[root@centos01 ~]# httpd -t
10.生成apache服务器控制文件添加执行权限
[root@centos01 ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@centos01 ~]# chmod +x /etc/init.d/httpd
11.修改apache服务控制文件在这里插入图片描述
12.添加系统服务设置开机自动启动
[root@centos01 ~]# chkconfig --add httpd
[root@centos01 ~]# chkconfig --level 35 httpd on
13.创建web目录,并在里边创建index.html文件
[root@centos01 ~]# mkdir /web
[root@centos01 ~]# echo “www.benet.com” > /web/index.html
14.复制
[root@centos01 ~]# cp /usr/local/httpd/conf/httpd.conf /usr/local/httpd/conf/httpd.conf.bak
15.更改配置在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

DNS服务器:
1.删除在/etc/yum.repos.d目录下所有
[root@centos02 ~]# rm -rf /etc/yum.repos.d/CentOS-*
2.创建local.repo文件并编写
[root@centos02 ~]# vim /etc/yum.repos.d/local.repo
在这里插入图片描述
3.挂载光盘
[root@centos02 ~]# mount /dev/cdrom /mnt/
4.安装DNS
[root@centos02 ~]# yum -y install bing bing-utils bind-chroot
5.编写配置文件
[root@centos02 ~]# cp /etc/named.conf /etc/named.conf.bak
[root@centos02 ~]# echo “” > /etc/named.conf
[root@centos02 ~]# vim /etc/named.conf
在这里插入图片描述
6.配置benet.com文件
[root@centos02 ~]# vim /var/named/benet.com.zone
7.修改网卡DNS信息
验证:使用客户端用域名访问网页
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值