安装Apache HTTP Server(Windows 10)

想在本地安装Apache HTTP Server,先找到官网 https://httpd.apache.org/
一通搜索之后没有发现安装包。静下心来仔细看说明,发现官网只提供源代码,不提供Windows的可执行文件。只能去第三方网站下载。

The Apache HTTP Server Project itself does not provide binary releases of software, only source code. Individual committers may provide binary packages as a convenience, but it is not a release deliverable.
If you cannot compile the Apache HTTP Server yourself, you can obtain a binary package from numerous binary distributions available on the Internet.
Popular options for deploying Apache httpd, and, optionally, PHP and MySQL, on Microsoft Windows, include:
ApacheHaus
・Apache Lounge
・BitNami WAMP Stack
・WampServer
・XAMPP

从上面的第一个URL进去,下载Apache的第三方编译文件。
httpd-2.4.34-o110h-x64-vc14.zip
解压到本地环境。


用cmd进入bin文件夹,执行以下命令将Apache加入Windows的Servers。

httpd -k install

运行错误。没有权限。


用管理员权限运行cmd,再次执行安装命令,再次发生错误。

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.
httpd:Syntax error on line 39 of D:/XXXX/httpd.conf: ServerRoot must be a valid directory

看来配置文件需要修改。


打开 httpd.conf文件。修改以下配置

38 Define SRVROOT “/Apache24”
39 ServerRoot “${SRVROOT}”

修改为

38 Define SRVROOT “D:/XXXX/Apache24”
39 ServerRoot “${SRVROOT}”

从Server中启动仍然失败,从Event Viewer中查看失败log,有以下三种信息。

The Apache service named reported the following error:
(OS 10048)通常、各ソケット アドレスに対してプロトコル、ネットワーク アドレス、またはポートのどれか 1 つのみを使用できます。 : AH00072: make_sock: could not bind to address [::]:443


The Apache service named reported the following error:
AH00451: no listening sockets available, shutting down


The Apache service named reported the following error:
AH00015: Unable to open logs

在cmd用以下命令找到占用443端口的程序的PID是13812,从任务管理器找到13812程序是 VMWare。不想动虚拟机的设置。于是返回继续找httpd的配置文件

netstat –ano


原来是ssl的配置文件中用到了443端口。
conf\extra\httpd-ssl.conf

Listen 443

改为444端口后再次尝试启动service。仍然报错…….
有漏网之鱼。httpd-ahssl.conf 文件中也有443端口设置。修改之后再次尝试启动service。再次失败。。。。。


尝试删除服务重新安装

httpd -k uninstall
httpd -k install

仍然失败。。。。。睡觉。明天再试。


20180914更新
conf\extra\httpd-ssl.conf 文件中有漏改的部分,修改之后成功启动server。搞定。

想来,其实ssl功能暂时用不上,直接从配置文件中去掉ssl的conf引用也能搞定。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值