Windows10安装Apache Http Server 2.4

最近学习Android需要安装Apache Http Sever 2.4,现在记录一下自己的安装与配置过程,包括启动http时出现的1053错误的解决方法。

下载Apache Http Sever 2.4

  1. 新进入下载的官网地址:Downloading the Apache HTTP Server ,如图所示。
    这里写图片描述

  2. 点击上图中用红色矩形圈出的链接 a number of third party vendors ,进入Downloading Apache for Windows的界面,如图所示。
    这里写图片描述

  3. 点击上图中的ApacheHaus ,进入下载页面,如图所示。
    这里写图片描述
  4. 向下滑动页面,在Apache 2.4 Server Binaries 栏目中选择适合自己的版本。32位的选择X86版本,64位的选择X64版本。本人选择下载的是httpd-2.4.29-o110g-x64-vc14.zip,如图所示。
    这里写图片描述
    如果安装了VPN可能下载会快一点,为了方便,分享一下百度云链接
    链接:https://pan.baidu.com/s/1i5TOwNr ,密码:f1yn

    安装与配置Apache Http Sever 2.4

    1. 解压压缩包,得到下图所示的文件。一个是安装说明readme_first.html,一个是Apache24的文件夹。
      这里写图片描述
    2. 本人将Apache24文件夹复制到E:/,并以管理员身份打开命令提示符,进入Apach24的bin目录。具体命令如下:
>e:
>cd Apache24
>cd bin

这里写图片描述
3.首先修改Apache24/conf/httpd的配置文件:
① 找到以下内容,将 “/Apache24”修改为当前Apache24的目录,我的是E:\Apache24。

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

② 修改端口号,找到以下内容,将“80”修改为“8080”。

Listen 12.34.56.78:80
Listen 80

4.在命令提示符中输入以下命令,安装http service。(注意:命令中,Apache24为安装的服务名称)

>httpd.exe -k install -n "Apache24" 

这里写图片描述
安装完成后可以通过win+R,输入services.msc,查看所有的服务。可以在服务中找到Apache24的服务。
这里写图片描述

启动Apache24 service

方式一:通过命令行启动

通过如下命令可以开启和关闭Apache24服务:

>httpd.exe -k start -n "Apache24"
>httpd.exe -k stop -n "Apache24"

这里写图片描述

附: 重启和卸载http的命令

>httpd.exe -k restart -n "Apache24"
>httpd.exe -k uninstall -n "Apache24"

方式二:通过ApacheMonitor启动
双击/bin目录下的ApacheMonitor.exe,在笔者的电脑上,这个程序会最小化到托盘:
这里写图片描述

双击图标,即可图形化的方式运行:
这里写图片描述
选中Apache24,可以start(启动)它,启动成功后,最小化到托盘的图标会变成绿色的三角形,说明已经成功启动。
这里写图片描述

在图形界面中也可以stop、restart该服务。
注意: 可以点击最小化的图标,选中Apache24,可以选择对Apache24的操作,包括start、stop、restart。
方式三:直接点击服务中的Apache24,启动或者停止服务

注意: 服务启动以后,可以在浏览器中输入http://127.0.0.1:8080,查看目录E:\Apache24\htdocs下的index.html文件。
这里写图片描述

以后自己想要放入服务器的文件,都放在目录E:\Apache24\htdocs下。比如我有一个名为get_data.xml的文件,通过http://127.0.0.1:8080/get_data.xml 可以访问。
这里写图片描述

解决启动Apache24 service时报错(1053)

安装好http server后,一直无法启动服务,使用上述的方式一和方式二均未成功,而且不知道错误在哪里。使用方式三启动服务时,系统报错1053:服务没有及时响应启动或控制请求。

后来参考这个链接https://www.apachelounge.com/viewtopic.php?p=34728 ,估计自己也是因为没有安装最新的vc_redist.x64.exe。

到windows官网下载该程序,完成安装后,服务能正常启动了。

vc_redist.x64.exe的下载地址:
https://www.microsoft.com/en-us/download/details.aspx?id=48145

猜你喜欢

转载自blog.csdn.net/u014454538/article/details/79261824