Web网站服务

【实验拓扑】
在这里插入图片描述
【实验环境】
某公司根据其信息化建设要求,需要构建一台独立配置的网站服务器。考虑到站点的运行效率,稳定性及可扩展性等因素,要求在CentOS 7 系统中构建httpd服务器,并使用httpd-2.2.17源码版本进行编译安装。
【需求描述】
编译安装httpd服务器,要求支持动态模块扩展、地址重写、多字符集。
网站名称设置为www.benet.com,默认首页设置为index.html和index.php。
将/usr/share/doc/HTML/zh-CN/目录下的index.html复制到网站根目录下并改名为redhat.
在浏览器中分别访问http://www.benet.com/redhat与http://www.benet.com/,查看不同测试页面。
【推荐步骤】
一、启用一台虚拟机作为Web服务器,编译安装httpd软件包。
1.将CentOS01配置为Web服务器,编译安装httpd软件包。
①使用Linux.iso镜像文件。
②挂载光盘并查看挂载目录数据。
[root@centos01 ~]# mount /dev/cdrom /mnt/
[root@centos01 ~]# ls /mnt/
③将源码程序包解压到指定目录中“/usr/src/”并进入httpd-2.2.17目录。
[root@centos01 ~]# tar zxvf /mnt/httpd-2.2.17.tar.gz -C /usr/src/
[root@centos01 ~]# cd /usr/src/httpd-2.2.17/
④配置Apache。
[root@centos01 httpd-2.2.17]#./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
⑤编译安装。
[root@centos01 httpd-2.2.17]# make && make install
2.查看是否安装成功,存在创建目录证明成功。
[root@centos01 ~]# ls -ld /usr/local/httpd/
在这里插入图片描述
二、配置并启动httpd服务器。
1.配置并启动httpd服务器。
①优化Apache
[root@centos01 ~]# ln -s /usr/local/httpd/bin/* /usr/local/bin/
②检查配置文件的完成性,显示OK成功。
[root@centos01 ~]# apachectl -t
③生成Apache服务器控制文件添加执行权限。
[root@centos01 ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@centos01 ~]# chmod +x /etc/init.d/httpd
④修改Apache服务控制文件。
[root@centos01 ~]# vim /etc/init.d/httpd
#!/bin/sh
#chkconfig:35 80 21
#description:Apache Server
⑤添加系统服务设置开机自启。
[root@centos01 ~]# chkconfig --add httpd
[root@centos01 ~]# chkconfig --level 35 httpd on
[root@centos01 ~]# systemctl start httpd
⑥设置备份
[root@centos01~]#cp /usr/local/httpd/conf/httpd.conf /usr/local/httpd/conf/httpd.conf.bak
⑦修改相关配置文件。
ServerName www.benet.com:80
DirectoryIndex index.html index.php

[root@centos01 ~]# cp /usr/share/doc/HTML/en-US/index.html /usr/local/httpd/htdocs/redHat
三、配置DNS服务。
[root@centos01 ~]# yum -y install bind bind-chroot
[root@centos01 ~]# cp /etc/named.conf /etc/named.conf.bak
[root@centos01 ~]# echo “” > /etc/named.conf
[root@centos01 ~]# vim /etc/named.conf
[root@centos01 ~]# vim /var/named/benet.com.zone
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值