Apache 安装过程以及遇到的一些问题及解决方法

安装版本Apache 2.4,运行环境是win7 64位。

1、解压文件到安装目录,这是我的安装目录:E:\apache\Apache24。

2、在该目录下,找到conf文件夹,打开并找到文件httpd.conf。用记事本打开该文件,找到一下几行:


Define SRVROOT "/Apache24"
ServerRoot "${SRVROOT}"

Listen 80

Define SRVROOT "/Apache24"更改双引号内容为文件绝对路径。

ServerRoot "${SRVROOT}"这里不需要更改,网上查到的部分相关教程提到这里要改为文件绝对路径,亲测是错的,这里不需要更改,需要改的是Define SRVROOT。

Listen 80先不要更改,因为80端口可能出现被占用的情况,所以很多教程都说要更改端口。但是我这里出现了问题,只有用80端口才能打开localhost,其他端口没用,原因不明。

更改后的情况是这样的:


Define SRVROOT "E:\apache\Apache24"
ServerRoot "${SRVROOT}"

Listen 80

保存并关闭httpd.conf文件。

3、用管理员权限打开cmd,用cd指令进入安装目录下的bin文件夹,输入httpd -k install指令并回车,出现下面信息,

e:\apache\Apache24\bin>httpd -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.

说明安装成功。如果没有问题请跳过下面这一段。

我在这里出现了问题,403端口被占用,信息如下

e:\apache\Apache24\bin>httpd -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
(OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。  : AH00072: make_sock: could not bind to address [::]:443
(OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。  : AH00072: make_sock: could not bind to address 0.0.0.0:443
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs

查了下,发现是之前安装的虚拟机共享占用了443端口,所以导致接下来启动服务出现以下信息

e:\apache\Apache24\bin>net start Apache2.4
Apache2.4 服务正在启动 .
Apache2.4 服务无法启动。

发生服务特定错误: 1.

请键入 NET HELPMSG 3547 以获得更多的帮助。

出现了发生服务特定错误: 1.

解决方法是禁用虚拟机共享,

然后cmd输入指令httpd -k uninstall卸载,再输入指令httpd -k install安装。

4、输入net start Apache2.4指令启动服务。

此时打开浏览器输入http://localhost/,可以到达Apache安装测试页,说明已经安装成功了。

net start Apache2.4  启动服务

net stop Apache2.4  关闭服务

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值