操作:Apache服务器搭建

实训目的:

掌握apache服务器的配置方法
掌握利用apache配置基于虚拟目录和虚拟主机的web服务器搭建方法

实验要求:

以学号为虚拟目录的web服务器搭建
实现利用不同域名搭建web虚拟主机

实验步骤:

1,设置系统IP地址为192.168.1.2
操作:Apache服务器搭建
2,查询系统是否安装httpd软件
操作:Apache服务器搭建
3,设置yum本地源
操作:Apache服务器搭建
操作:Apache服务器搭建
4,使用yum安装httpd软件
操作:Apache服务器搭建
5,启动httpd服务并查看服务状态
操作:Apache服务器搭建
6,编辑主配置文件
操作:Apache服务器搭建
修改如下:

  • ServerRoot"/etc/httpd"
  • Listen 80
  • ServerAdmin [email protected]
  • ServerName 192.168.1.2:80
  • DocumentRoot “/var/www/html”
  • DirectoryIndex index.html

7,新建虚拟目录文件存放位置和虚拟目录首页文件
操作:Apache服务器搭建
8,新建虚拟目录配置文件
操作:Apache服务器搭建
操作:Apache服务器搭建
9,检查配置文件
操作:Apache服务器搭建
10,关闭SELinux
操作:Apache服务器搭建
11,重新启动 httpd服务
操作:Apache服务器搭建
12,客户端测试
操作:Apache服务器搭建
操作:Apache服务器搭建
13,创建虚拟主机所需的目录和文件
操作:Apache服务器搭建
操作:Apache服务器搭建
14,复制虚拟主机配置文件模板并编辑配置文件
操作:Apache服务器搭建
操作:Apache服务器搭建
15,检查apche配置文件是否有错误
操作:Apache服务器搭建
16,重新启动httpd服务
操作:Apache服务器搭建
17,修改hosts文件
操作:Apache服务器搭建
操作:Apache服务器搭建
18,客户端访问验证
操作:Apache服务器搭建