Apache的下载与安装

1、准备安装包
下载你需要的Apache安装包https://www.apachehaus.com/cgi-bin/download.plx


Apache的下载与安装


2、解压文件到指定安装目录


Apache的下载与安装


Apache的下载与安装


3.替换安装路径
使用文本编辑器打开Apache的配置文件conf/httpd.conf 执行文本替换 将"/Apache24” 全部替换成(你自己解压的路径) “E:/JAVA学习/前端Web/学校Web程序设计课件/httpd-2.4.46-o111g-x64-vc15/Apache24”

Apache的下载与安装


Apache的下载与安装


4. 配置服务器域名(非必须)
我这里修改为本机地址并使用8080端口号

Apache的下载与安装



5. 安装Apache
打开CMD窗口,进入服务bin目录,输入安装命令(httpd -k install)开始安装服务

Apache的下载与安装

输入启动命令(net start apache2.4)启动服务

Apache的下载与安装



补充:除了上述启动方式,也可以通过Apache自带的管理窗口进行启动和关闭

Apache的下载与安装

Apache的下载与安装

Apache的下载与安装


6. 访问测试
在浏览器打开http://localhost:8080/


7、设 置 Web 服 务 器 设 置 根 目 录 文 档,访问本地页面
在E:\下新建一个目录,目录名 webs;将要访问的页面放在该目录下。

Apache的下载与安装

8、在httpd.conf中修改下列参数。

Apache的下载与安装


9、访问http://localhost:8080/exp2.html

Apache的下载与安装