Apache HTTP Server在Windows下的搭建

    xiaoxiao2021-03-25  146

          最近在学安卓,看《第一行代码》看到了网络编程,其中有关于Apache HTTP Server的搭建的内容,但是书上几笔带过,而且Apache官网上安装方式也已经变更,所以我在这里把我安装的过程写下来。

    如果帮到了你,我会很开心。

    --------------------------------------------------------------------

    1.进入Apache HTTP Server 下载网站:http://httpd.apache.org/download.cgi

    2.选择一个服务器的版本,这里选择Apache HTTP Server 2.4.25 (httpd): 2.4.25 is the latest available version 

    3.点击Files for Microsoft Windows

    4.在Downloading Apache for Windows这一栏,Apache说明了不给出运行版本,只给出源码,需要自己编译。但是在下面给了几个链接,是几个站点帮我们编译好了a binary package。随便选一个进去。

    5.下载对应自己电脑的操作系统的版本,比如64位下载httpd-2.4.25-win64-VC14.zip       

    6.将压缩包解压至任意目录,点开readme_first.html,阅读内容(看完你就会安装了其实)

    7.英文太长不想看,那就继续阅读我的废话吧:打开cmd(win键+r),cd进入解压目录的 \Apace24\bin 录(比如e:\Apace24\bin),输入“httpd -k install”,如果没有报错,则安装成功。

    8.当然不可能不报错,进入\Apache24\conf目录下打开httpd.conf,将 Define SRVROOT "E:\ApacheService\Apache24" ServerRoot "${SRVROOT}"

    中红字改成你电脑中的相应位置。

    9.再次安装httpd -k install”,应该不会报错。

    10.再在cmd中输入“httpd -k start”,如果没有提示错误,即可在浏览器中输入http://127.0.0.1,查看,如果没有出现错误,即安装成功。

    11.当然也报错,提示端口不正确。再次打开httpd.conf,修改其中的端口

    #Listen 12.34.56.78:80 Listen 80

    Listen 8088  (或者其他)

    再次输入“httpd -k restart”,没有出现错误即可正常运行服务器。

    12.此时进入服务器主页面的网址为:http://127.0.0.1:8088

    13.网页放在 \Apache24\htdocs目录下,即可通过网址访问,如:http://127.0.0.1:8088/index.html

    转载请注明原文地址: https://ju.6miu.com/read-8695.html

    最新回复(0)